26 lines
391 B
Go
26 lines
391 B
Go
package config
|
|
|
|
import (
|
|
"encoding/json"
|
|
"os"
|
|
)
|
|
|
|
type AppConfig struct {
|
|
SqlTablesDir string `json:"sql-tables-dir"`
|
|
}
|
|
|
|
var appConfigInstance *AppConfig
|
|
|
|
func Setup() {
|
|
file, err := os.ReadFile("config.json")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
if err = json.Unmarshal(file, &appConfigInstance); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
func GetAppConfig() *AppConfig { return appConfigInstance }
|