added slapapi

This commit is contained in:
2026-02-17 08:12:07 +11:00
parent 85fcf104b9
commit e50f855206
14 changed files with 427 additions and 46 deletions

View File

@@ -10,19 +10,21 @@ import (
"git.haelnorr.com/h/oslstats/internal/discord"
"git.haelnorr.com/h/oslstats/internal/rbac"
"git.haelnorr.com/h/oslstats/pkg/oauth"
"git.haelnorr.com/h/oslstats/pkg/slapshotapi"
"github.com/joho/godotenv"
"github.com/pkg/errors"
)
type Config struct {
DB *db.Config
HWS *hws.Config
HWSAuth *hwsauth.Config
HLOG *hlog.Config
Discord *discord.Config
OAuth *oauth.Config
RBAC *rbac.Config
Flags *Flags
DB *db.Config
HWS *hws.Config
HWSAuth *hwsauth.Config
HLOG *hlog.Config
Discord *discord.Config
OAuth *oauth.Config
RBAC *rbac.Config
Slapshot *slapshotapi.Config
Flags *Flags
}
// GetConfig loads the application configuration and returns a pointer to the Config object
@@ -42,6 +44,7 @@ func GetConfig(flags *Flags) (*Config, *ezconf.ConfigLoader, error) {
discord.NewEZConfIntegration(),
oauth.NewEZConfIntegration(),
rbac.NewEZConfIntegration(),
slapshotapi.NewEZConfIntegration(),
)
if err != nil {
return nil, nil, errors.Wrap(err, "loader.RegisterIntegrations")
@@ -93,15 +96,21 @@ func GetConfig(flags *Flags) (*Config, *ezconf.ConfigLoader, error) {
return nil, nil, errors.New("RBAC Config not loaded")
}
slapcfg, ok := loader.GetConfig("slapshotapi")
if !ok {
return nil, nil, errors.New("SlapshotAPI Config not loaded")
}
config := &Config{
DB: dbcfg.(*db.Config),
HWS: hwscfg.(*hws.Config),
HWSAuth: hwsauthcfg.(*hwsauth.Config),
HLOG: hlogcfg.(*hlog.Config),
Discord: discordcfg.(*discord.Config),
OAuth: oauthcfg.(*oauth.Config),
RBAC: rbaccfg.(*rbac.Config),
Flags: flags,
DB: dbcfg.(*db.Config),
HWS: hwscfg.(*hws.Config),
HWSAuth: hwsauthcfg.(*hwsauth.Config),
HLOG: hlogcfg.(*hlog.Config),
Discord: discordcfg.(*discord.Config),
OAuth: oauthcfg.(*oauth.Config),
RBAC: rbaccfg.(*rbac.Config),
Slapshot: slapcfg.(*slapshotapi.Config),
Flags: flags,
}
return config, loader, nil