-
Notifications
You must be signed in to change notification settings - Fork 2
/
config.go
30 lines (24 loc) · 831 Bytes
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright 2017 Matt Spaulding. All rights reserved.
// Package wreck implements the wreck command line tool
package wreck
import (
"os"
"github.com/spf13/viper"
)
// GlobalConfig stores global configurations
var GlobalConfig = viper.New()
// UserConfig stores user specific configurations
var UserConfig = viper.New()
func init() {
GlobalConfig.AddConfigPath(".")
GlobalConfig.AddConfigPath("/etc")
GlobalConfig.SetConfigName("wreck")
GlobalConfig.SetDefault("headers.common.content-type", "text/plain")
GlobalConfig.SetDefault("headers.common.user-agent", "wreck/1.0")
GlobalConfig.SetDefault("headers.post.content-type", "application/json")
GlobalConfig.ReadInConfig()
UserConfig.AddConfigPath(".")
UserConfig.AddConfigPath(os.Getenv("HOME"))
UserConfig.SetConfigName(".wreck")
UserConfig.ReadInConfig()
}