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: ...
Burrus asked 1/10, 2018 at 6:0

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...
Cathodoluminescence asked 8/11, 2017 at 16:50

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...
Beeswing asked 18/3, 2021 at 1:24

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: ${...
Photoemission asked 11/10, 2018 at 9:20

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 ...
Bleeding asked 2/9, 2020 at 16:26

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...
Buckwheat asked 8/5, 2017 at 12:32

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...
Flyblown asked 28/5, 2021 at 16:25

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...
Vanquish asked 21/8, 2020 at 17:43

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...
Bordure asked 10/8, 2020 at 13:17

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...
Joinery asked 6/3, 2016 at 13:3

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 ...
Querulous asked 9/7, 2018 at 13:11

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...
Jane asked 8/7, 2018 at 2:35

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...
Terryterrye asked 13/4, 2018 at 14:39

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...
Sferics asked 15/7, 2017 at 17:27

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...
Misbegotten asked 12/3, 2017 at 11:56

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...
Kellda asked 13/1, 2017 at 9:14

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...
Recess asked 10/1, 2017 at 20:56

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 ...
Inseminate asked 8/2, 2016 at 20:5
1

© 2022 - 2024 — McMap. All rights reserved.