Questions tagged [viper-go]

This tag is for questions related to the Go Viper package for reading configuration data from files and other sources.

Viper is a configuration package for Go. It supports reading configuration data from many formats (JSON, TOML, YAML, HCL, or Java properties) and other sources, like environment variables and command line flags, setting defaults and overriding them. Optionally, configuration files can be watched and reloaded whenever they change.

96 questions
0
votes
1 answer

go routine with net/http dynamically created using viper config

I have viper providing the following values in config.yml & attached the rest of the configs here: servers: - projectname: test directory: D:\playgroud\test port: 1029 - projectname: test1 directory: D:\playground\test1 port:…
0
votes
0 answers

Only return specific fields from struct

I have a pair of structs like so: type Datacenter struct { Name string Key string Hosts []Host } type Host struct { Name string Port int } And then an example configuration file: datacenters: - name: dc1 key:…
jaxxstorm
  • 12,422
  • 5
  • 57
  • 67
0
votes
1 answer

How to use golang viper Watchconfig & onConfigChange

I am trying to read my application configuration using golang viper and would like to read the latest config always. Please find my code below config.go package config import ( "github.com/spf13/viper" "log" …
inari6
  • 401
  • 1
  • 9
  • 19
0
votes
1 answer

viper yaml config sequence

I'm trying to read a yaml config file using viper (see viper docs). But I cannot see a way to read the sequence of map values under issue-types. I've tried the various Get_ methods but none seem to support this. remote: host: http://localhost/ …
trorbyte
  • 115
  • 1
  • 2
  • 6
0
votes
3 answers

Converting JSON object array to YAML

I have the following json which needs to convert to YAML { "siteidparam": "lid", "sites": [ { "name": "default", "routingmethod": { "method": "urlparam", "siteid": "default", "urlpath": "default" } …
Anuruddha
  • 3,187
  • 5
  • 31
  • 47
0
votes
0 answers

Initializing a new Go configuration with Viper

I've been exploring configuration management in Go using the viper package, which I learned about in another question. I'm having trouble understanding how to initialize a new configuration. What I want to do is to find system configurations if they…
Scott Deerwester
  • 3,503
  • 4
  • 33
  • 56
1 2 3 4 5 6
7