Initial commit
This commit is contained in:
commit
36baaf0caf
10 changed files with 961 additions and 0 deletions
40
config.go
Normal file
40
config.go
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
// Standard
|
||||
"encoding/json"
|
||||
"os"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
Network struct {
|
||||
Address string
|
||||
Port int
|
||||
}
|
||||
|
||||
Logging struct {
|
||||
URL string
|
||||
System string
|
||||
Instance string
|
||||
LogDir string
|
||||
}
|
||||
|
||||
Device struct {
|
||||
Address string
|
||||
Port int
|
||||
Username string
|
||||
Password string
|
||||
Timeout int
|
||||
}
|
||||
}
|
||||
|
||||
func readConfig() (config Config, err error) {
|
||||
var configData []byte
|
||||
configData, err = os.ReadFile(flagConfig)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = json.Unmarshal(configData, &config)
|
||||
return
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue