65 lines
1.9 KiB
Go
65 lines
1.9 KiB
Go
package app
|
|
|
|
import (
|
|
"embed"
|
|
|
|
"github.com/jmoiron/sqlx"
|
|
|
|
"arimelody-web/model/twitch"
|
|
|
|
logService "arimelody-web/service/log"
|
|
inviteService "arimelody-web/service/invite"
|
|
accountService "arimelody-web/service/account"
|
|
sessionService "arimelody-web/service/session"
|
|
artistService "arimelody-web/service/artist"
|
|
releaseService "arimelody-web/service/release"
|
|
trackService "arimelody-web/service/track"
|
|
)
|
|
|
|
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
|
|
Twitch *twitch.State
|
|
PublicFS embed.FS
|
|
|
|
LogService *logService.LogService
|
|
InviteService *inviteService.InviteService
|
|
AccountService *accountService.AccountService
|
|
SesisonService *sessionService.SessionService
|
|
ArtistService *artistService.ArtistService
|
|
ReleaseService *releaseService.ReleaseService
|
|
TrackService *trackService.TrackService
|
|
}
|
|
)
|