improve fault tolerance and OS compat beyond linux
This commit is contained in:
parent
8e4f353be1
commit
75bd36a332
3 changed files with 30 additions and 20 deletions
|
|
@ -85,12 +85,12 @@ func New(ctx context.Context, opts ServiceOptions) (*Service, error) {
|
|||
|
||||
var config serviceConfig
|
||||
if configFile, err := os.OpenFile(path.Join(DATA_PATH, "twitch-config.json"), os.O_CREATE | os.O_RDWR, 0600); err != nil {
|
||||
log.Fatalf("Failed to open twitch-config.json: %v", err)
|
||||
return nil, fmt.Errorf("Failed to open twitch-config.json: %v", err)
|
||||
} else {
|
||||
defer configFile.Close()
|
||||
// TODO: write template file if empty
|
||||
if err := json.NewDecoder(configFile).Decode(&config); err != nil {
|
||||
log.Fatalf("Failed to read twitch-config.json: %v", err)
|
||||
return nil, fmt.Errorf("Failed to read twitch-config.json: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue