Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Kevin Lyda
gitlab-sandbox
Commits
c2a73881
Commit
c2a73881
authored
Jan 23, 2017
by
Kevin Lyda
💬
Browse files
Read config.
parent
bb3257c1
Changes
2
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
c2a73881
/pjls
/config
/config
.json
cmd/pjls/pjls.go
View file @
c2a73881
...
...
@@ -16,8 +16,10 @@ func main() {
viper
.
SetConfigName
(
"config"
)
viper
.
AddConfigPath
(
"."
)
viper
.
SetConfigType
(
"json"
)
err
:=
viper
.
ReadInConfig
()
viper
.
Unmarshal
(
&
c
)
c
.
token
=
viper
.
Get
(
"token"
)
c
.
baseurl
=
viper
.
Get
(
"baseurl"
)
if
err
!=
nil
{
panic
(
fmt
.
Errorf
(
"Fatal error config file: %s
\n
"
,
err
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment