Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    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"
    }
    In the example above, I'm dumping all settings, then settings from viper.Sub("subcmd")
    where value1 = a is set in a yaml config file
    Depado
    @Depado
    Hey, anyone around here ?
    Just got a quick question, if I'm using pflag (which allows to define a default value) is it still useful to use viper.SetDefault ?
    Vadim Yermolin
    @vadimyer
    Hi
    Can Viper watch and reload environment variables changes?
    Till Wegmüller
    @Toasterson
    Yes it's in the README. CTRL-F for watch.
    Vadim Yermolin
    @vadimyer
    Do you mean I should define env as a remote provider?
    Till Wegmüller
    @Toasterson
    Ah environment variables... Sorry was thinking of the watch changes feature. But Environment Variables should not be a problem for implementing a watcher. AFAIK there is no method for notification about change in an ENvironment variable in Unix. So more than a for loop would not be possible anyway.
    Vadim Yermolin
    @vadimyer
    Uh, okay, so the only way is to manually watch or/and reload?
    Till Wegmüller
    @Toasterson
    AFAIK yes. Curious idea to watch for environment variables for changes. It's the first time I have heard of it. How would change them anyhow. Is there a Way in C to do so?
    or Bash?
    Vadim Yermolin
    @vadimyer
    Welp, I'm not sure this is possible either...
    Nhoya
    @Nhoya
    Hi all
    can someone please review and approve #450 since it should fix a game-breaking problem?
    Thanks
    @spf13
    rush24
    @rush24
    Hi, just meeting viper, i have problem that it won't read from file each time when viper.Get("key"), right? (i hope it was loaded in memory
    Noah Gray
    @NoahGray_gitlab
    excuse the newb question, but how would i use "or" here
    cfg := &ServerConfig{
      RedisURL:                viper.GetString("redis_port_6379_tcp"),
    }
    would this do
    cfg := &ServerConfig{
      RedisURL:                viper.GetString("redis_port_6379_tcp") | viper.GetString("database_url"),
    }
    vodolaz095
    @vodolaz095
    var redisURL = viper.GetString("redis_port_6379_tcp")
    if viper.GetString("database_url") != "" {
          redisURL= viper.GetString("database_url"),
    }
    cfg := &ServerConfig{
      RedisURL:                redisURL,
    }
    Stephen Hoekstra
    @shoekstra

    Hi! I've noticed when loading an HCL file that it is read with slices under each key and not as a hash. The file is read correctly when using hcl.Decode, so it seems to be something with viper.

    I seem to hit the same thing whether using viper.ReadInConfig or viper.ReadConfig and wondering something had come across this or if I'm doing something wrong. (not sure best way to share example code and output)

    Shivaprasad Bhat
    @spy16
    Hello All!. Need help. I am using viper for one of my projects. There are different environments - dev, testing, CI etc.. the config list is very large to override values through environment variables. so my question is what would be the best way to have a base config and override as required for different environments?..
    expecting something like
    db_host: localhost
    db_user: appuser
    
    test:
        db_host: test-host
    rehs0y
    @y0sher
    how do I pass string arrays to viper/cobra from command line ?
    Joe Percivall
    @JPercivall

    Hello Devs, I use Viper to handle the configuration for a REST service. DELETE/POST/PUT requests have the potential to modify the config after which I use viper.WriteConfig() to persist the changes.

    My question is whether other or not there's a built-in or easy way to do a rolling history of the last X number of configs? I've looked at the docs, and I don't believe so, but wanted to reach out to double check.

    Márk Sági-Kazár
    @sagikazarmark
    I don't think there is, but I hardly think it should be viper's responsibility
    Alessandro Tagliapietra
    @alex88
    Hello everyone, is there a way to parse something like this?
    app:
      cron:
        - frequency: "@daily"
          minVal: 1
          maxVal: 1000000
    Alessandro Tagliapietra
    @alex88
    ohh, unmarshal :D
    Akaash Patnaik
    @akaashanky
    Hi all. I'm running into a problem trying to pass my Viper object around my app (a REST API) as a singleton. When using it within the app, I initialise the Viper object in the main package, from a config yaml and pass this same object around and things work great. But when trying to initialise the config from test files in different packages the yaml isn't accessible because Viper tries to find it relative to the package it's being initialised from.
    I guess I must be doing this wrong. Any suggestions? Or can anyone point me to any reference code where the test code in a different package accesses the same config as the app?
    Akaash Patnaik
    @akaashanky
    I should mention that the config yaml currently lives alongside some initialisation code within a "config" package under my base package
    Akaash Patnaik
    @akaashanky
    For anyone who's interested, I've just decided to work my way around the problem by passing the config file location as an argument to the function that initialises the Viper object. Not sure if this is an anti-pattern, but it fixes my issues for now.
    Márk Sági-Kazár
    @sagikazarmark
    I don't think that's an anti-pattern.
    Justus Luthy (Boatright)
    @dellintosh
    confirmation: assuming that I have an environment variable MY_VARIABLE, does Viper do any kind of default rewriting (aside from lowercase) to access that value? So Get("my_variable")...? If I want it to be camelCase I'll need to SetEnvKeyReplacer, right? (Looking at viper_test.go it seems this is how it works).
    haha... just noticed the last message in here was 4 months ago. :)
    pradeepkusingh
    @pradeepkusingh
    How to read json/yaml/properties files from GITURI?