erop
erop

Reputation: 1590

Getting app stack configuration in Spryker

As I understand there is \Spryker\Shared\Config\Config::get method to access configuration stored in config/Shared dir. Does Spryker have anything similar to get values from deploy.*.yml files?

Upvotes: 0

Views: 191

Answers (1)

Tomasz Ferfecki
Tomasz Ferfecki

Reputation: 1263

If you declare variables in deploy.*.yml You can use them to set ENV in docker sdk

Example for passing env from deploy file to yves

Open file deploy.yml and add configuration

regions:
    EU:
        config:
            something:
                my_key: value

Then create twig for env in docker configuration. docker/generator/src/templates/env/something/something.env.twig

Content of file

SOMETHING_MY_KEY={{ serviceData['my_key'] }}

Open yves twig for environment variables docker/generator/src/templates/env/application/yves.env.twig

And add include for template

{% include "env/something/something.env.twig" with {
    serviceData: project['regions']['EU']['config']['something'],
    serviceName: 'something'
} %}

Make sure to pass correct name to access twing template and serviceData later.

After that you can add env variable to config file (config/Shared/config_*.php)

$config['<Const for my module>'] = getenv('SOMETHING_MY_KEY');

Upvotes: 1

Related Questions