refactored out global
. long live AppState
This commit is contained in:
parent
3d674515ce
commit
384579ee5e
24 changed files with 350 additions and 375 deletions
|
@ -2,6 +2,8 @@ package model
|
|||
|
||||
import "time"
|
||||
|
||||
const COOKIE_TOKEN string = "AM_TOKEN"
|
||||
|
||||
type (
|
||||
Account struct {
|
||||
ID string `json:"id" db:"id"`
|
||||
|
|
32
model/appstate.go
Normal file
32
model/appstate.go
Normal file
|
@ -0,0 +1,32 @@
|
|||
package model
|
||||
|
||||
import "github.com/jmoiron/sqlx"
|
||||
|
||||
type (
|
||||
DBConfig struct {
|
||||
Host string `toml:"host"`
|
||||
Port int64 `toml:"port"`
|
||||
Name string `toml:"name"`
|
||||
User string `toml:"user"`
|
||||
Pass string `toml:"pass"`
|
||||
}
|
||||
|
||||
DiscordConfig struct {
|
||||
AdminID string `toml:"admin_id" comment:"NOTE: admin_id to be deprecated in favour of local accounts and SSO."`
|
||||
ClientID string `toml:"client_id"`
|
||||
Secret string `toml:"secret"`
|
||||
}
|
||||
|
||||
Config struct {
|
||||
BaseUrl string `toml:"base_url" comment:"Used for OAuth redirects."`
|
||||
Port int64 `toml:"port"`
|
||||
DataDirectory string `toml:"data_dir"`
|
||||
DB DBConfig `toml:"db"`
|
||||
Discord DiscordConfig `toml:"discord"`
|
||||
}
|
||||
|
||||
AppState struct {
|
||||
DB *sqlx.DB
|
||||
Config Config
|
||||
}
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue