viper-go Questions
4
How do I write the code below to get a string from my nested yaml struct?
Here is my yaml:
element:
- one:
url: http://test
nested: 123
- two:
url: http://test
nested: 123
weather:
- test:
...
2
Solved
Is it possible to load/merge multiple config files with Viper? Say I have a general config file containing configuration for my program, and client specific config files with configuration for each...
3
Solved
So I have a pretty basic configuration with Viper reading a .env file from my base directory. I fatal kill the process if there's no .env file. All goes well when running my app normally.
When I ru...
6
I'm trying to have application.yaml file in go application which contains ${RMQ_HOST} values which I want to override with environment variables.
In application.yaml I've got:
rmq:
test:
host: ${...
1
I use Viper https://github.com/spf13/viper for managing project configurations in my GO app, and also for Unmarshaling configuration values to a struct.
var config c.Configuration // Configuration ...
4
Solved
The documentation in Cobra and Viper are confusing me. I did cobra init fooproject and then inside the project dir I did cobra add bar. I have a PersistentFlag that is named foo and here is the ini...
3
Solved
I've just recently started working with Go, and I've run into some
behavior working with Cobra and Viper that I'm not sure I understand.
This is a slightly modified version of the sample code you g...
1
Solved
I don't really understand how viper works.
This is my code:
configuration.go
var Config *Configuration
type ServerConfiguration struct {
Port string
}
type Configuration struct {
Server ServerC...
1
Solved
I'm maintaining some code written using Go (golang), Viper and Cobra.
On one line, it has:
rootCmd.PersistentFlags().String("cfg", "", "A description")
And then on th...
2
Solved
I am developing an web app with Go. So far so good, but now I am integrating Wercker as a CI tool and started caring about testing. But my app relies heavily on Cobra/Viper configuration/flags/envi...
1
Solved
I noticed that this is perhaps a bug when viper tries to unmarshall to struct. To explain it better, consider this:
I have a cli command like below
dd-cli submit-bug --name "Bug 1" --tag reason1 ...
1
Solved
I have this following config file defined as toml file:
[staging]
project-id = "projectId"
cluster-name = "cluster"
zone = "asia-southeast1-a"
Then, I have this struct
type ConfigureOpts struc...
1
Solved
I am trying to make Viper read my environment variables, but its not working. Here is my configuration:
# app.yaml
dsn: RESTFUL_APP_DSN
jwt_verification_key: RESTFUL_APP_JWT_VERIFICATION_KEY
jwt_s...
1
Solved
I have the following config I want to load with viper:
artist:
name: The Beatles
albums:
- name: The White Album
year: 1968
- name: Abbey Road
year: 1969
I can't work out how to load a lis...
1
Solved
I am building a little app using Viper and Cobra. At the moment, I have a yaml file like this:
hosts:
- name: host1
port: 90
key: my_key
- name: host2
port: 90
key: prompt
And I've read in...
4
I'm new to go and I'm using viper to load all my configs. What I currently have is YAML that looks like:
countryQueries:
sg:
- qtype: gmap
qplacetype: postal_code
- qtype: gmap
qplacetype: ad...
1
Solved
Basic information: I have created a go application and used Cobra for it. Cobra uses Viper for command line parameters and flags.
I have a command listen with a flag bind and I want to configure i...
1
For a project I'm working on I'm trying to pass a map of stings as an environment variable using Viper. I tried several approaches to achieve this but with no success. When I read the env variable ...
1
© 2022 - 2024 — McMap. All rights reserved.