Skip to content

Commit

Permalink
Merge pull request #18 from anivon/master
Browse files Browse the repository at this point in the history
Remove env vars prefix
  • Loading branch information
Ph3nol authored Oct 3, 2017
2 parents 5afa191 + 07d9fd2 commit bddb991
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function execute(): void
// Volumes.
$this
->addVolume([
'local' => '${'.$project->generateEnvKey('ELASTIC_SEARCH_DATA_LOCATION').'}',
'local' => '${ELASTIC_SEARCH_DATA_LOCATION}',
'remote' => '/usr/share/elasticsearch/data',
'type' => 'rw',
]);
Expand Down
2 changes: 1 addition & 1 deletion src/Application/DockerContainer/MysqlDockerContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function execute(): void
// Volumes.
$this
->addVolume([
'local' => '${'.$project->generateEnvKey('MYSQL_DATA_LOCATION').'}',
'local' => '${MYSQL_DATA_LOCATION}',
'remote' => '/var/lib/mysql',
'type' => 'rw',
]);
Expand Down
2 changes: 1 addition & 1 deletion src/Application/DockerContainer/NginxDockerContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function execute(): void
$project->addEnv('NGINX_LOGS_LOCATION', Architect::GLOBAL_ABSOLUTE_TMP_DIRECTORY.'/logs/nginx');
$this
->addVolume([
'local' => '${'.$project->generateEnvKey('NGINX_LOGS_LOCATION').'}',
'local' => '${NGINX_LOGS_LOCATION}',
'remote' => '/var/log/nginx',
'type' => 'rw',
]);
Expand Down
4 changes: 2 additions & 2 deletions src/Domain/DockerContainer/Model/DockerContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public function setPackageManager(string $packageManager): self
*/
public function addEnvFromProject(string $key): self
{
$this->envs[$key] = '${'.$this->getService()->getProject()->generateEnvKey($key).'}';
$this->envs[$key] = '${' . key . '}';

return $this;
}
Expand All @@ -189,7 +189,7 @@ public function addEnvPort(string $envProperty, array $port): array

$portKey = $service->generateEnvKey($envProperty.'_PORT');
$project->addEnv($portKey, $port['from']);
$port['from'] = '${'.$project->generateEnvKey($portKey).'}';
$port['from'] = '${' . $portKey . '}';
$this->addPort($port);

return $port;
Expand Down
14 changes: 1 addition & 13 deletions src/Domain/Project/Model/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
*/
class Project implements ProjectInterface
{
const DOCKER_ENV_CONFIGURATION_PREFIX = 'DOCKER_CONFIG_';

use TemplatedFilesPropertyTrait;
use DockerContainerEnvsTrait;

Expand Down Expand Up @@ -228,22 +226,12 @@ public function getLabel(): string
return $this->label;
}

/**
* @param string $key
*
* @return string
*/
public function generateEnvKey(string $key): string
{
return self::DOCKER_ENV_CONFIGURATION_PREFIX.$key;
}

/**
* {@inheritdoc}
*/
public function addEnv(string $key, string $value): self
{
$this->envs[$this->generateEnvKey($key)] = $value;
$this->envs[$key] = $value;

return $this;
}
Expand Down

0 comments on commit bddb991

Please sign in to comment.