0

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?

erop
  • 1,510
  • 1
  • 14
  • 27

1 Answers1

1

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');
Tomasz Ferfecki
  • 1,263
  • 14
  • 22