diff --git a/src/Client.php b/src/Client.php index 2c7d172..e922a28 100644 --- a/src/Client.php +++ b/src/Client.php @@ -121,7 +121,7 @@ public function pullConfigBatch(array $namespaceNames) foreach ($namespaceNames as $namespaceName) { $request = []; - $config = (new Config($this->saveDir))->setNamespace($namespaceName); + $config = new Config($this->saveDir,$this->appId,$namespaceName); $requestUrl = $url . $namespaceName; $params['releaseKey'] = $config->get('apolloReleaseKey', ''); diff --git a/src/Config.php b/src/Config.php index e30ee03..2cc4cdc 100644 --- a/src/Config.php +++ b/src/Config.php @@ -7,6 +7,8 @@ class Config implements \ArrayAccess { + protected $appId; + protected $configDir = ''; protected $configFile = ''; @@ -20,9 +22,11 @@ class Config implements \ArrayAccess protected $loadConfig = false; - public function __construct($configDir) + public function __construct($configDir, $appId = 'apolloConfig', $namespace = 'application') { $this->configDir = $configDir; + $this->appId = $appId; + $this->setNamespace($namespace); } /** @@ -52,7 +56,7 @@ protected function loadConfig() public function getConfigFile() { - $this->configFile = $this->configDir . DIRECTORY_SEPARATOR . "apolloConfig.{$this->namespace}.ini"; + $this->configFile = $this->configDir . DIRECTORY_SEPARATOR . "{$this->appId}.{$this->namespace}.ini"; return $this->configFile; }