HEAVY: migrate accounts and logs to service/repo architecture
This commit is contained in:
parent
5c255fb34b
commit
49e14b5bc5
37 changed files with 1019 additions and 687 deletions
54
model/app/appstate.go
Normal file
54
model/app/appstate.go
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
package app
|
||||
|
||||
import (
|
||||
"embed"
|
||||
|
||||
"github.com/jmoiron/sqlx"
|
||||
|
||||
"arimelody-web/model/twitch"
|
||||
accountService "arimelody-web/service/account"
|
||||
"arimelody-web/service/log"
|
||||
)
|
||||
|
||||
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"`
|
||||
}
|
||||
|
||||
TwitchConfig struct {
|
||||
Broadcaster string `toml:"broadcaster"`
|
||||
ClientID string `toml:"client_id"`
|
||||
Secret string `toml:"secret"`
|
||||
}
|
||||
|
||||
Config struct {
|
||||
BaseUrl string `toml:"base_url" comment:"Used for OAuth redirects."`
|
||||
Host string `toml:"host"`
|
||||
Port int64 `toml:"port"`
|
||||
DataDirectory string `toml:"data_dir"`
|
||||
TrustedProxies []string `toml:"trusted_proxies"`
|
||||
DB DBConfig `toml:"db"`
|
||||
Discord *DiscordConfig `toml:"discord"`
|
||||
Twitch *TwitchConfig `toml:"twitch"`
|
||||
}
|
||||
|
||||
AppState struct {
|
||||
DB *sqlx.DB
|
||||
Config Config
|
||||
Log *log.LogService
|
||||
Twitch *twitch.State
|
||||
PublicFS embed.FS
|
||||
|
||||
AccountService *accountService.AccountService
|
||||
}
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue