Initial commit
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.ohea.xyz/golang/config"
|
||||
)
|
||||
|
||||
type Webhook struct {
|
||||
Secret string
|
||||
}
|
||||
|
||||
type Job struct {
|
||||
URL *string
|
||||
Folder *string
|
||||
Webhook Webhook
|
||||
Cron *string
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
Address string
|
||||
Port int
|
||||
Jobs map[string]Job
|
||||
}
|
||||
|
||||
func GetConfig() (config.Config[Config], error) {
|
||||
configData := config.Config[Config]{
|
||||
Name: "cursorius",
|
||||
Filename: "server",
|
||||
Config: Config{
|
||||
Address: "127.0.0.1",
|
||||
Port: 45420,
|
||||
Jobs: make(map[string]Job),
|
||||
},
|
||||
}
|
||||
|
||||
_, err := configData.Get()
|
||||
if err != nil {
|
||||
return configData, fmt.Errorf("Could not read config file: %v", err)
|
||||
}
|
||||
|
||||
return configData, nil
|
||||
}
|
||||
Reference in New Issue
Block a user