You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
787 B
54 lines
787 B
package config
|
|
|
|
import (
|
|
"log"
|
|
"encoding/json"
|
|
"os"
|
|
)
|
|
|
|
type config struct {
|
|
Server struct {
|
|
Admin string
|
|
Views string
|
|
Layouts string
|
|
HostPort string
|
|
}
|
|
Database struct {
|
|
Driver string
|
|
Url string
|
|
}
|
|
Redis struct {
|
|
HostPort string
|
|
Password string
|
|
DB int
|
|
}
|
|
Email struct {
|
|
Host string
|
|
Port int
|
|
XMailer string
|
|
UserAgent string
|
|
RedisQueue string
|
|
Templates string
|
|
}
|
|
Paypal struct {
|
|
ClientID string
|
|
SecretID string
|
|
URL string
|
|
}
|
|
}
|
|
|
|
var Settings config
|
|
|
|
func Load(path string) {
|
|
data, err := os.ReadFile(path)
|
|
|
|
if err != nil {
|
|
log.Fatalf("error loading %s: %v", path, err)
|
|
}
|
|
|
|
err = json.Unmarshal(data, &Settings)
|
|
|
|
if err != nil {
|
|
log.Fatal("error parsing %s: %v", path, err)
|
|
}
|
|
}
|
|
|