Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there any opportunity to set env variable in php process? #30

Open
enl opened this issue Aug 4, 2016 · 3 comments
Open

Is there any opportunity to set env variable in php process? #30

enl opened this issue Aug 4, 2016 · 3 comments

Comments

@enl
Copy link

enl commented Aug 4, 2016

Ok, I need to set environment variable for php process while starting built-in server. This is necessary in order to switch to testing database.

My application config file looks like this:

$connection = [
     'database' => getenv('DATABASE_NAME') ?: 'default-name',
];

So all I need is to set DATABASE_NAME variable before starting php -S process. Is there any opportunity to achieve this? Here it is my codeception.yml:

extensions:
    config:
        Codeception\Extension\PhpBuiltinServer:
            hostname: localhost
            port: 8000
            autostart: true
            documentRoot: web
            startDelay: 1
            phpIni: /etc/php5/apache2/php.ini
            router: web/index.php
            directoryIndex: index.php
@enl
Copy link
Author

enl commented Aug 4, 2016

Oh, I actually see #27 and #13 pull requests about exactly the same...

@mbrodala
Copy link
Contributor

mbrodala commented Feb 9, 2017

You can simply export environment variables before running CodeCeption, the PHP server process will then respect these.

@jtojnar
Copy link

jtojnar commented Mar 12, 2018

Setting environment variables before running will not work with Environments feature of Codeception as far as I can tell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants