Welcome Guest, Not a member yet? Register   Sign In
getting env variables in CI in Docker
#1

(This post was last modified: 02-11-2021, 06:16 AM by richb201.)

I have created an environment variable called TESTHOST in my docker-compose file. I know this works because when i run  docker exec 98e bash -c 'echo "$TESTHOST"' from the cli, it prints out the correct TESTHOST value (2). My problem is getting it into CI. 
I have tried:
        $testhost=$this->config->item('TESTHOST');  
and also
        $testhost=getenv('TESTHOST');


But $testhost returns false when it should return 2. I also tried looking in the $_ENV but there is no TESTHOST there. How can I get the env variable into my app? 

I did find
PassEnv Directive

Description:
Passes environment variables from the shell
Syntax:


Code:
PassEnv env-variable [env-variable] ...

Context:
server config, virtual host, directory, .htaccess
Override:
FileInfo
Status:
Base
Module:
mod_env


Specifies one or more native system environment variables to make available as internal environment variables, which are available to Apache HTTP Server modules as well as propagated to CGI scripts and SSI pages. Values come from the native OS environment of the shell which invoked the 

Code:
httpd

 process.

Example
PassEnv LD_LIBRARY_PATH

But I am not sure where to put PassEnv TESTHOST ? I don't have access to rebuilding the docker image. 
proof that an old dog can learn new tricks
Reply




Theme © iAndrew 2016 - Forum software by © MyBB