Skip to content

How to pass parameters into template!? #280

Open
@FractalMind

Description

@FractalMind

I'm running in circles here...

I want to pass parameters DURING CONTAINER RUNTIME from a hostsList.csv to a nginx.tmpl and generate a "default.conf" like so:
docker-gen nginx.tmpl default.conf
The only way I saw people pass parameters to a template is with "environment variables":

{{ range $myvar, $containers := groupByMulti $ "Env.MYENVVAR" "," }}
	#I wanna print this: {{ $myvar }}
{{ end }}

My goal is to modify the "hostsList.csv" to load hosts on the fly while the container is running and compose my default.conf with new hosts.

But Docker is setup in a way that environment variables are set in stones... I can't find how to modify them once the container run.

Is there another way to pass parameters to the template other than environment variables!?

Something like
docker-gen nginx.tmpl default.conf -params MYVARLIST="111111.com,22222.com,3333.com"
Or at least How can I modify the environment variables at runtime? -_-"

Thank you for your time! :D

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions