DEV Community

csgeek
csgeek

Posted on

1 2

Docker Config PreProcessor

So, I keep on running into this issue time and time again. I need to dockerize an app, but the application doesn't follow the https://12factor.net/ design or at the very least it's not allowing ENV overrides.

There are tools now that are agnostic to what format the config file is in. (yaml, json, .ini ) and is able to read the configuration in.

https://github.com/spf13/viper is a great example and https://gitlab.com/dashwav/gila is another python example.

How does everyone else deal with updating configs that doesn't support env? I was thinking of writing a tool where my docker image just invokes a pre-processor that is ENV aware.

like

#!/usr/bin/env bash 
preprocess --config foobar.template foobar.properties

$@

Wouldn't it be worthwhile to create something that adapts the config rather than updating the config by exposing it via volumes or doing weird sed/regex pre-processing?

Any thoughts?

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay