Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LaaS
logstash-forwarder
Commits
1362db1c
Commit
1362db1c
authored
Jul 02, 2013
by
Jordan Sissel
Browse files
- use `` string literals for struct tags. Lets me do `json:"ssl
certificate"` for worded json keys
parent
7a564696
Changes
1
Hide whitespace changes
Inline
Side-by-side
config.go
View file @
1362db1c
...
...
@@ -4,21 +4,25 @@ import (
"encoding/json"
"os"
"log"
"time"
)
type
Config
struct
{
Network
NetworkConfig
"
json:network
"
Files
[]
FileConfig
"
json:files
"
Network
NetworkConfig
`
json:network
`
Files
[]
FileConfig
`
json:files
`
}
type
NetworkConfig
struct
{
Servers
[]
string
"json:servers"
SSLCertificate
string
"json:ssl certificate"
}
Servers
[]
string
`json:servers`
SSLCertificate
string
`json:"ssl certificate"`
SSLKey
string
`json:"ssl key"`
SSLCA
string
`json:"ssl ca"`
Timeout
time
.
Duration
`json:timeout`
}
type
FileConfig
struct
{
Paths
[]
string
"
json:paths
"
Fields
map
[
string
]
string
"
json:fields
"
Paths
[]
string
`
json:paths
`
Fields
map
[
string
]
string
`
json:fields
`
}
func
LoadConfig
(
path
string
)
(
config
Config
,
err
error
)
{
...
...
@@ -45,5 +49,9 @@ func LoadConfig(path string) (config Config, err error) {
return
}
if
config
.
Network
.
Timeout
==
0
{
config
.
Network
.
Timeout
=
5
*
time
.
Second
}
return
}
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