Refactor and remove sqlite and replace with MySQL

This commit is contained in:
2025-10-23 18:43:31 +01:00
parent d53e27eea8
commit 21ebc9c34b
139 changed files with 1013 additions and 529 deletions

View File

@@ -0,0 +1,30 @@
package bootstrap
import (
"encoding/json"
"fmt"
"os"
"synlotto-website/models"
)
type AppState struct {
Config *models.Config
}
func LoadAppState(configPath string) (*AppState, error) {
file, err := os.Open(configPath)
if err != nil {
return nil, fmt.Errorf("open config: %w", err)
}
defer file.Close()
var config models.Config
if err := json.NewDecoder(file).Decode(&config); err != nil {
return nil, fmt.Errorf("decode config: %w", err)
}
return &AppState{
Config: &config,
}, nil
}