'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?



Solution 1:[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');

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 walkingRed