@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add an extensible "SiteSource" for configuration

Summary:
Fixes T2792. This adds a pluggable configuration layer between all the stuff on disk (local/file) and the runtime configurable stuff (database).

An install can subclass this source and:

- For Phacility, query a remote service (like Almanac) to retrieve hostname-based configuration, allowing one install to serve multiple instances.
- Maybe for Phacility, query a remote service (like Phlux) to retrieve sitevar-like configuration (e.g., put everything in readonly mode to deal with a maintenance issue?). Not sure if we'll do this or not. We might just nuke Phlux since Almanac is sort-of-a-superset of it for our purposes.
- For third parties, query some other remote service if that makes config management easier. In particular, it would theoretically let you put locked config in Zookeeper or whatever else you want.

Test Plan: Added a fake source and saw it inject configuration.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T2792

Differential Revision: https://secure.phabricator.com/D10787

+28
+2
src/__phutil_library_map__.php
··· 1455 1455 'PhabricatorConfigSchemaQuery' => 'applications/config/schema/PhabricatorConfigSchemaQuery.php', 1456 1456 'PhabricatorConfigSchemaSpec' => 'applications/config/schema/PhabricatorConfigSchemaSpec.php', 1457 1457 'PhabricatorConfigServerSchema' => 'applications/config/schema/PhabricatorConfigServerSchema.php', 1458 + 'PhabricatorConfigSiteSource' => 'infrastructure/env/PhabricatorConfigSiteSource.php', 1458 1459 'PhabricatorConfigSource' => 'infrastructure/env/PhabricatorConfigSource.php', 1459 1460 'PhabricatorConfigStackSource' => 'infrastructure/env/PhabricatorConfigStackSource.php', 1460 1461 'PhabricatorConfigStorageSchema' => 'applications/config/schema/PhabricatorConfigStorageSchema.php', ··· 4534 4535 'PhabricatorConfigSchemaQuery' => 'Phobject', 4535 4536 'PhabricatorConfigSchemaSpec' => 'Phobject', 4536 4537 'PhabricatorConfigServerSchema' => 'PhabricatorConfigStorageSchema', 4538 + 'PhabricatorConfigSiteSource' => 'PhabricatorConfigProxySource', 4537 4539 'PhabricatorConfigStackSource' => 'PhabricatorConfigSource', 4538 4540 'PhabricatorConfigStorageSchema' => 'Phobject', 4539 4541 'PhabricatorConfigTableSchema' => 'PhabricatorConfigStorageSchema',
+17
src/infrastructure/env/PhabricatorConfigSiteSource.php
··· 1 + <?php 2 + 3 + /** 4 + * Optional configuration source which loads between local sources and the 5 + * database source. 6 + * 7 + * Subclasses of this source can read external configuration sources (like a 8 + * remote server). 9 + */ 10 + abstract class PhabricatorConfigSiteSource 11 + extends PhabricatorConfigProxySource { 12 + 13 + public function getPriority() { 14 + return 1000.0; 15 + } 16 + 17 + }
+9
src/infrastructure/env/PhabricatorEnv.php
··· 153 153 // pull in all options from non-phabricator libraries now they are loaded. 154 154 $default_source->loadExternalOptions(); 155 155 156 + // If this install has site config sources, load them now. 157 + $site_sources = id(new PhutilSymbolLoader()) 158 + ->setAncestorClass('PhabricatorConfigSiteSource') 159 + ->loadObjects(); 160 + $site_sources = msort($site_sources, 'getPriority'); 161 + foreach ($site_sources as $site_source) { 162 + $stack->pushSource($site_source); 163 + } 164 + 156 165 try { 157 166 $stack->pushSource( 158 167 id(new PhabricatorConfigDatabaseSource('default'))