2

We deploy services as docker containers using Marathon. The containers include a base config file, Marathon pulls an environment config file (which has a subset of the base keys) at deployment time so when the app starts it has;

  • environment.toml
  • config.toml

when reading the config we need to conflate the values in both files to a single set, effectively masking/shadowing the values present in both files with those in the environment file.

I didn't find this functionality in the Viper docs. Unless I have missed something it seems my options are;

  • Write a package that uses Viper to read both files and perform the conflation.
  • Extend Viper

Before I start writing code, is there already a mechanism for doing this?

Andreas ZUERCHER
  • 862
  • 1
  • 7
  • 20
Myles McDonnell
  • 12,943
  • 17
  • 66
  • 116
  • I haven't read files with viper, I've only used it behind cobra for parsing config flags. However I use it like `serverCmd.Flags().StringVarP(&Cfg.BindAddress, "bind", "b", "0.0.0.0", "the listen interface")`, maybe you can similarly write the values of both configs into shared pointers? – Plato Jun 29 '16 at 11:17

0 Answers0