package main

import (
	// Standard
	"encoding/json"
	"os"
)

type DatabaseDetails struct {
	Host     string
	Port     int
	Name     string
	Username string
	Password string
}


type Config struct {
	Network struct {
		Address string
		Port    int
	}

	Websocket struct {
		Domains []string
	}

	Database DatabaseDetails

	NodataInterval int `json:"nodata_interval"` // in seconds
}

func initConfig(fname string) (cfg Config, err error) {// {{{
	var data []byte
	data, err = os.ReadFile(fname)
	if err != nil {
		return
	}

	err = json.Unmarshal(data, &cfg)
	return
}// }}}
