FAQ
I'm wondering how do you configure your web apps written in Go for
production and development environment. Do you just use YAML files and
maintain one with production secrets?

Here's my take on it:
https://github.com/tomazk/envcfg

* apps should store configuration in the environment as per manifestos like
"12 factor app"
* lib github.com/tomazk/envcfg encourages you to define a struct that'll
hold your env variables as fields
* use envcfg.Unmarshal to unmarshal env variables to the object with the
type you defined in the struct
* store this object globally and access it when configuring clients and
services

Any thoughts?

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Edward Muller at Dec 2, 2014 at 12:16 am
    We use https://github.com/joeshaw/envdecode <https://github.com/joeshaw/envdecode> a bunch.

    I should compare/contrast the approaches at some point.

    On Dec 1, 2014, at 3:52 PM, Tomaz Kovacic wrote:

    I'm wondering how do you configure your web apps written in Go for production and development environment. Do you just use YAML files and maintain one with production secrets?

    Here's my take on it:
    https://github.com/tomazk/envcfg <https://github.com/tomazk/envcfg>

    * apps should store configuration in the environment as per manifestos like "12 factor app"
    * lib github.com/tomazk/envcfg encourages you to define a struct that'll hold your env variables as fields
    * use envcfg.Unmarshal to unmarshal env variables to the object with the type you defined in the struct
    * store this object globally and access it when configuring clients and services

    Any thoughts?

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com For more options, visit https://groups.google.com/d/optout <https://groups.google.com/d/optout>.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Frederic Marand at Dec 2, 2014 at 8:28 am
    I have collected a number of configuration related choices on our wiki :

    http://wiki.audean.com/go/packages?&#configuration

    Most of them do not use the environment but configuration files, and that's
    a point on which I disagree with the 12-factor approach too, so it makes
    sense to see so many packages around configuration files instead of the
    environment.

    Le mardi 2 décembre 2014 00:52:33 UTC+1, Tomaz Kovacic a écrit :
    I'm wondering how do you configure your web apps written in Go for
    production and development environment. Do you just use YAML files and
    maintain one with production secrets?

    Here's my take on it:
    https://github.com/tomazk/envcfg

    * apps should store configuration in the environment as per manifestos
    like "12 factor app"
    * lib github.com/tomazk/envcfg encourages you to define a struct that'll
    hold your env variables as fields
    * use envcfg.Unmarshal to unmarshal env variables to the object with the
    type you defined in the struct
    * store this object globally and access it when configuring clients and
    services

    Any thoughts?
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedDec 1, '14 at 11:52p
activeDec 2, '14 at 8:28a
posts3
users3
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase