-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.go
35 lines (32 loc) · 897 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
31
32
33
34
35
package orderbookfetcher
import (
"encoding/json"
"os"
)
type Configuration struct {
// how many orderbooks are we saving on disk (per location)
RetentionPeriod uint `json:"retentionPeriod"`
// how often are we fetching?
Interval uint `json:"interval"`
// what regions are we fetching?
Regions []uint64 `json:"regions"`
// what citadels are we fetching?
Citadels []uint64 `json:"citadels"`
// client id for the esi application
ClientID string `json:"clientId"`
// refresh token to retrieve our access token
RefreshToken string `json:"refreshToken"`
}
// load a configuration from a text file
func LoadConfiguration(fileName string) (*Configuration, error) {
file, err := os.Open(fileName)
if err != nil {
return nil, err
}
defer file.Close()
var config *Configuration
if err = json.NewDecoder(file).Decode(&config); err != nil {
return nil, err
}
return config, nil
}