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

-envFile option to read variables from within container at runtime #678

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kinnalru
Copy link

@kinnalru kinnalru commented Mar 2, 2020

I need to change Consul service description from inside container by custom application logic. This patch allow this by specifying -envFile option to registrator which is the file path inside containers. Registrator try reads this file at runtime from each container instance and use as another source of configuration like Labels or ENV but with highest priority.

Examples:
File /tmp/dynamic_envs inside test_container

SERVICE_NAME=my_new_service_name
SERVICE_TAGS=tag1,tag2
SERVICE_ANOTHER=custom_metadata_value

Registrator launch:

./registrator -ip 172.99.1.1 -cleanup -ttl 40 -ttl-refresh 10 -resync 60 -envFile /tmp/dynamic_envs consul://172.99.1.1:8500

Dynamic changes:

docker exec -it test_container /bin/sh -c "echo SERVICE_META=123 >> /tmp/dynamic_envs"

After refresh interval(10s) new metadata with name meta and value 123 appear in already registered consul service.

What do you think?

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

Successfully merging this pull request may close these issues.

1 participant