added oauth flow to get authorization code
This commit is contained in:
@@ -6,6 +6,8 @@ import (
|
||||
"git.haelnorr.com/h/golib/hws"
|
||||
"git.haelnorr.com/h/golib/hwsauth"
|
||||
"git.haelnorr.com/h/oslstats/internal/db"
|
||||
"git.haelnorr.com/h/oslstats/internal/discord"
|
||||
"git.haelnorr.com/h/oslstats/pkg/oauth"
|
||||
"github.com/joho/godotenv"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
@@ -15,6 +17,8 @@ type Config struct {
|
||||
HWS *hws.Config
|
||||
HWSAuth *hwsauth.Config
|
||||
HLOG *hlog.Config
|
||||
Discord *discord.Config
|
||||
OAuth *oauth.Config
|
||||
Flags *Flags
|
||||
}
|
||||
|
||||
@@ -32,6 +36,8 @@ func GetConfig(flags *Flags) (*Config, *ezconf.ConfigLoader, error) {
|
||||
hws.NewEZConfIntegration(),
|
||||
hwsauth.NewEZConfIntegration(),
|
||||
db.NewEZConfIntegration(),
|
||||
discord.NewEZConfIntegration(),
|
||||
oauth.NewEZConfIntegration(),
|
||||
)
|
||||
if err := loader.ParseEnvVars(); err != nil {
|
||||
return nil, nil, errors.Wrap(err, "loader.ParseEnvVars")
|
||||
@@ -65,11 +71,23 @@ func GetConfig(flags *Flags) (*Config, *ezconf.ConfigLoader, error) {
|
||||
return nil, nil, errors.New("DB Config not loaded")
|
||||
}
|
||||
|
||||
discordcfg, ok := loader.GetConfig("discord")
|
||||
if !ok {
|
||||
return nil, nil, errors.New("Dicord Config not loaded")
|
||||
}
|
||||
|
||||
oauthcfg, ok := loader.GetConfig("oauth")
|
||||
if !ok {
|
||||
return nil, nil, errors.New("OAuth 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),
|
||||
Flags: flags,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user