mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 08:26:00 +01:00
28 lines
660 B
Go
28 lines
660 B
Go
package jsonschema
|
|
|
|
import (
|
|
"encoding/json"
|
|
"github.com/stashapp/stash/internal/logger"
|
|
"os"
|
|
)
|
|
|
|
type Config struct {
|
|
Stash string `json:"stash"`
|
|
Metadata string `json:"metadata"`
|
|
// Generated string `json:"generated"` // TODO: Generated directory instead of metadata
|
|
Cache string `json:"cache"`
|
|
Downloads string `json:"downloads"`
|
|
}
|
|
|
|
func LoadConfigFile(file string) *Config {
|
|
var config Config
|
|
configFile, err := os.Open(file)
|
|
defer configFile.Close()
|
|
if err != nil {
|
|
logger.Error(err.Error())
|
|
}
|
|
jsonParser := json.NewDecoder(configFile)
|
|
parseError := jsonParser.Decode(&config)
|
|
if parseError != nil { panic(parseError) }
|
|
return &config
|
|
}
|