Skip to content

A simple shellscript to easily substitue config files based on env variables

License

Notifications You must be signed in to change notification settings

alinmear/docker-configomat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker-configomat

Build Status Github Stars Github Forks Gitter

A simple shellscript to easily substitue config files based on env variables

This little project should make the configuration part of small docker projects easier.

NOTE:

  • For now you must have the bash shell installed. Especially alpine is using sh by default (apk add --no-update --no-cache bash).
  • key=value pairs without spaces are not supported at the moment (key = value is supported)

Logics

Just define an env prefix, the key and the value of a config file:

cat /etc/kopano/ical.cfg:

[...]
# File with RSA key for SSL
ssl_private_key_file = /ssl/key.pem

# File with certificate for SSL
ssl_certificate_file = /ssl/cert.pem

# Verify client certificate
ssl_verify_client = no
[...]
export LDAP_SSL_PRIVATE_KEY_FILE=/tmp/test.pem
export LDAP_SSL_VERIFY_CLIENT=yes
configomat.sh LDAP_ /etc/kopano/ical.cfg

Usage

configomat.sh <PREFIX> <FILE>
# or
configomat.sh <PREFIX> "<FILE1> <FILE2> <FILE3>"

Use within your docker project

  • Add subproject
cd <your-project>
git submodule add https://github.com/alinmear/docker-configomat.git
git commit
  • Extend your Dockerfile with theses lines
COPY docker-configomat/configomat.sh /usr/local/bin
RUN chmod +x /usr/local/bin/*

Now you can call the script within your other scripts like described above:

configomat.sh <PREFIX> <FILES>

About

A simple shellscript to easily substitue config files based on env variables

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •