Add finishing touches
This commit is contained in:
parent
40328cb228
commit
88469fe6a2
@ -1,11 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import "fmt"
|
|
||||||
|
|
||||||
/*
|
|
||||||
This app is a migration tool from v0.0.7 to v0.0.8
|
|
||||||
*/
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
fmt.Println("Hello, World!")
|
|
||||||
}
|
|
@ -14,6 +14,7 @@ type Config struct {
|
|||||||
DiscordClientID string
|
DiscordClientID string
|
||||||
DiscordClientSecret string
|
DiscordClientSecret string
|
||||||
DiscordRedirectURL string
|
DiscordRedirectURL string
|
||||||
|
SessionSecret string
|
||||||
|
|
||||||
Version bool
|
Version bool
|
||||||
}
|
}
|
||||||
@ -25,6 +26,7 @@ func NewConfig() (*Config, error) {
|
|||||||
discordClientID := flag.String("discord-client-id", "", "Discord OAuth2 client ID (see https://discord.com/developers/applications)")
|
discordClientID := flag.String("discord-client-id", "", "Discord OAuth2 client ID (see https://discord.com/developers/applications)")
|
||||||
discordClientSecret := flag.String("discord-client-secret", "", "Discord OAuth2 client secret (see https://discord.com/developers/applications)")
|
discordClientSecret := flag.String("discord-client-secret", "", "Discord OAuth2 client secret (see https://discord.com/developers/applications)")
|
||||||
discordRedirectURL := flag.String("discord-redirect-url", "", "Discord OAuth2 redirect URL (<scheme>://<domain>/login/callback)")
|
discordRedirectURL := flag.String("discord-redirect-url", "", "Discord OAuth2 redirect URL (<scheme>://<domain>/login/callback)")
|
||||||
|
sessionSecret := flag.String("session-secret", "", "Session secret")
|
||||||
flagVersion := flag.Bool("version", false, "prints version of the application")
|
flagVersion := flag.Bool("version", false, "prints version of the application")
|
||||||
|
|
||||||
envflag.Parse(envflag.WithPrefix("FS_"))
|
envflag.Parse(envflag.WithPrefix("FS_"))
|
||||||
@ -36,6 +38,7 @@ func NewConfig() (*Config, error) {
|
|||||||
DiscordClientID: *discordClientID,
|
DiscordClientID: *discordClientID,
|
||||||
DiscordClientSecret: *discordClientSecret,
|
DiscordClientSecret: *discordClientSecret,
|
||||||
DiscordRedirectURL: *discordRedirectURL,
|
DiscordRedirectURL: *discordRedirectURL,
|
||||||
|
SessionSecret: *sessionSecret,
|
||||||
|
|
||||||
Version: *flagVersion,
|
Version: *flagVersion,
|
||||||
}
|
}
|
||||||
@ -56,6 +59,9 @@ func NewConfig() (*Config, error) {
|
|||||||
if config.DiscordRedirectURL == "" {
|
if config.DiscordRedirectURL == "" {
|
||||||
return nil, errors.New("missing discord-redirect-url argument")
|
return nil, errors.New("missing discord-redirect-url argument")
|
||||||
}
|
}
|
||||||
|
if config.SessionSecret == "" {
|
||||||
|
return nil, errors.New("missing session-secret argument")
|
||||||
|
}
|
||||||
|
|
||||||
return config, nil
|
return config, nil
|
||||||
}
|
}
|
||||||
|
@ -13,4 +13,5 @@ services:
|
|||||||
- FS_DISCORD_CLIENT_ID=xxxxxxxxxxxxxxxxxx
|
- FS_DISCORD_CLIENT_ID=xxxxxxxxxxxxxxxxxx
|
||||||
- FS_DISCORD_CLIENT_SECRET=xxxxxxxxxxxxxxxxxx
|
- FS_DISCORD_CLIENT_SECRET=xxxxxxxxxxxxxxxxxx
|
||||||
- FS_DISCORD_REDIRECT_URL=<scheme>://<domain>/login/callback
|
- FS_DISCORD_REDIRECT_URL=<scheme>://<domain>/login/callback
|
||||||
|
- FS_SESSION_SECRET=xxxxxxxxxxxxxxxxxx
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
@ -66,7 +66,7 @@ func Start(c *Config) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
store := gormsessions.NewStore(db, true, []byte("secret"))
|
store := gormsessions.NewStore(db, true, []byte(c.SessionSecret))
|
||||||
db.AutoMigrate(&Benchmark{})
|
db.AutoMigrate(&Benchmark{})
|
||||||
|
|
||||||
// Setup gin //
|
// Setup gin //
|
||||||
|
Loading…
Reference in New Issue
Block a user