[dancer-users] Passing environment to dockerized Dancer2

Stefan Hornburg (Racke) racke at linuxia.de
Sat Jun 19 08:48:20 EDT 2021


On 18/06/2021 20:42, Mikko Johannes Koivunalho wrote:
> Dear Dancer users,
> 
> I want to run my Dancer2 application in a docker but I want to run the docker without mounting any local directories and I want to run the same container in all environments, not compile it separately for different environments.
> 
> Problem:
> How do I pass the environment dependent parts of the configuration to the docker? I cannot use file `config_local.yaml` because then I would need to copy that file somehow into the container when it starts.
> 
> Possible solution:
> I would pass parts of the configuration as environment variables, e.g. /DB_HOST/ and /SITE_URL/, and then apply these over the values in config.yaml when I am creating the endpoints.
> 
> Suggestion:
> Change the command `/config/` (or the underlying file reader function) so that it can transpose environment variables into config strings, e.g. plugins->database->connections->main->host = '${DB_HOST}'.
> 

Hello Mikko,

you could use a start script instead running your Dancer application when the container launches.

The start script writes the config_local.yaml and starts Dancer.

Regards
          Racke

> 
> -- 
> Mikko Koivunalho
> [ This message has been signed with PGP. Public key available at request. ]
> 
> 
> _______________________________________________
> dancer-users mailing list
> dancer-users at lists.preshweb.co.uk
> https://lists.preshweb.co.uk/mailman/listinfo/dancer-users
> 


-- 
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration.



More information about the dancer-users mailing list