Initial commit

This commit is contained in:
Artem Mamonov
2025-02-06 02:36:10 +01:00
commit acf9b43671
24 changed files with 1946 additions and 0 deletions

40
internal/config/app.go Normal file
View File

@@ -0,0 +1,40 @@
package config
import (
"gopkg.in/yaml.v3"
"os"
"time"
)
var app App
type App struct {
Data string `yaml:"data"`
Db string `yaml:"db"`
Static string `yaml:"static"`
Watermark string `yaml:"watermark"`
SessionTtl time.Duration `yaml:"session_ttl"`
AlbumTtl time.Duration `yaml:"album_ttl"`
}
func ReadConfig(filename string) error {
// read config from yaml file
file, err := os.Open(filename)
if err != nil {
return err
}
defer file.Close()
// decode yaml
decoder := yaml.NewDecoder(file)
err = decoder.Decode(&app)
if err != nil {
return err
}
return nil
}
func Get() App {
return app
}