Skip to content

Commit

Permalink
调整下配置
Browse files Browse the repository at this point in the history
  • Loading branch information
xiehuanjin committed Oct 16, 2019
1 parent f016a84 commit 48a4353
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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', '');
Expand Down
8 changes: 6 additions & 2 deletions src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

class Config implements \ArrayAccess
{
protected $appId;

protected $configDir = '';

protected $configFile = '';
Expand All @@ -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);
}

/**
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 48a4353

Please sign in to comment.