Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    cesco
    @cescoferraro
    @spf13 hello! I was wondering this today. If a flag contains a dash, shouldnt viper.BindpFlag bind also to an environment without the dash to avoid http://unix.stackexchange.com/questions/23659/can-shell-variable-include-character ? I wish I could figure out a way to have a --mongo-host flag and MONGOHOST environment var
    Eddie Huang
    @inoc603
    Hi. I was trying viper.Unmarshal today, and found that it doesn't seem to work with field tags
    type T struct {
        val int `yaml:"with_underscore"`
    }
    
    func TestUnmarshal(t *testing.T) {
        a := assert.New(t)
    
        yamlExample := []byte(`a: 2
    with_underscore: 1`)
    
        viper.SetConfigType("yaml")
        viper.ReadConfig(bytes.NewBuffer(yamlExample))
    
        a.Equal(1, viper.GetInt("with_underscore"))
    
        tmp := T{}
        err := viper.Unmarshal(&tmp)
        a.Nil(err)
        a.Equal(1, tmp.val)
    }
    the with_underscore field didn't get unmarshaled into tmp. is there anyway around this?
    Eddie Huang
    @inoc603
    oh, never mind, I checked the source and find that I need to use mapstructure as tagname
    Marcus Franke
    @Comradin

    Hi, I have a yaml based config with a structure, that is in parts two levels deep. Like this:

    foo: "bar"
    groups:
    • foo: "baz"
    doh
    some markup.. sorry
    I have no problem with viper.GetString("foo")
    but Viper.GetString("groups.foo") returns an empty string
    How do I access the keys below the groups:
    Marcus Franke
    @Comradin
    Ok, found the error, my yaml file was malformed
    instead of:
    groups:
    • foo: "bar"
    groups:
    foo: "bar"
    withouth a trailing dash, the markdown will render as an enumeration ;)
    Tobias Wellnitz
    @dh1tw

    I'm using viper and cobra and bind the cobra flags to viper values. What is the order how viper determines the value? My understanding is:

    1. Flags
    2. toml/yaml... files
    3. default values set for flags

    Is this correct?

    Mario
    @mariolasagna
    Hi there. I'm trying to open a conf file but I'm getting an error: Config File "tst.conf" Not Found "[/home/m/Desktop/Devel/Go/src/tst]" Any restriction on specifying the full file name?
    Mario
    @mariolasagna
    I believe I found the solution. I had to use the extension toml instead of conf.
    Any ideas about how to have a different extension even if it's belongs to a format such as toml?
    Cameron Moore
    @moorereason
    @mariolasagna, SetConfigType and SetConfigFile
    Mario
    @mariolasagna
    @moorereason thank you. I'll check it out!!
    Marcus Franke
    @Comradin
    Hi, with viper.AddConfigPath("/etc/global_dir") and viper.AddConfigPath("$HOME") I have two directories where viper can look for my config file. But with viper.SetConfigName("foo") it will look for /etc/global_dir/foo.(yaml|json|...). But for the lookup in the $HOME directory it will not look for a .foo.(yaml|json|...) but for a non dot'ed config file.
    Is there a toggle to make viper look for a .foo.* config file?
    Steve Louie
    @stephenrlouie

    hi viper folks, is this intentional new behavior around isSet(). isSet() now returns true as soon as I bind a flag to viper, it used to remain false until some input (config, command line, ENV) set the value that was not the flag default.

    I've also commented on this spf13/viper#276 from November '16 and hoped others could provide details on #276 so we can determine if this is desired or a bug.

    Ryan Bastic
    @rbastic
    Hi all
    Arafat Hussain
    @rftHss
    Hello and welcome back, I am Arafat Hussain, a front-end developer.
    Hope you are doing well.
    I am @rftHss on GitHub.
    Ryan Bastic
    @rbastic
    Is this project active? I see issues not being responded to, and there are year-old questions about race conditions when using viper in certain ways.
    Cameron Moore
    @moorereason
    @rbastic, yes, it's active.
    Ryan Bastic
    @rbastic
    @moorereason Thanks for responding. I've noticed that UnmarshalKey() does not work in many instances and the codebase is not thread-safe, so I rewrote a small core of Viper available here: github.com/rbastic/mvga for any interested parties. Target use case is microservices which require dynamic configuration reloads.
    Philippe Castonguay
    @PhABC
    Is the the Ethereum Viper gitter room? Or a different viper?
    Marcus Franke
    @Comradin
    No, this is the Gitter room for the golang viper library
    Philippe Castonguay
    @PhABC
    Cheers
    Fred
    @ffjabbari
    I need a working example to read kv from consul
    I am sorry I am using GO language and I need a working example to read data from consul. Thanks in advance
    let me be more clear. I use a GO language and I need a working example to use viper to read data from CONSUL. Thanks for your help in advance
    Fjolnir-Dvorak
    @Fjolnir-Dvorak
    Are here maintainers for viper not called Steve? It is quite sad that the project viper seemes to be dead and that there is no interest in merging pull-requests like saving-config. I am getting more and more disappointed about this project when I am seeing that the pull requests are just beeing "ignored".
    And if there aren't. Could it be manageable to change this? It is very frustrating to try to fix anything seeing this amount of long-time ignored pull-requests
    Fjolnir-Dvorak
    @Fjolnir-Dvorak
    as far as I know spf13 was ill and has a lot to do, so I do not want to look at him.
    Fjolnir-Dvorak
    @Fjolnir-Dvorak
    Is it compartible to cobra?
    Steve Francia
    @spf13
    mvga looks pretty cool.
    after GopherCon a goal is to spend more time on cobra and viper. Agree they both need attention and I've been overwhelmed with other things.
    Stefan Hagen
    @sdrees
    Good plans and news, thanks for sharing
    Ryan Bastic
    @rbastic
    @spf13 that's flattering of you to say so. i may include that quote in mvga's README, with your permission :)
    Steve Francia
    @spf13
    feel free
    Jacob Case
    @jacobcase
    hello
    any idea with this pull will get merged? spf13/viper#331
    Jacob Case
    @jacobcase
    @spf13 based on following issues on github, it looks like that pull request would fix an issue I'm having.
    If I bind a pflag under a nested key, and I dump everything with AllSettings(), I see my cli override. If I do a viper.Sub(...), then dump AllSettings() with that sub viper, I only get variables that are in the config file.
    15:10:14 jcase@jcase-mn1 vipertest ./vipertest -l debug subcmd --value1 h --value2 b
    ALL SETTINGS JSON
    {
      "log_level": "debug",
      "subcmd": {
        "value1": "h",
        "value2": "b"
      }
    }
    SUB SETTINGS JSON
    {
      "value1": "a"
    }