Initial refactor of settings.
Signed-off-by: Odyssey <odyssey346@disroot.org>
This commit is contained in:
22
config/authtoken.go
Normal file
22
config/authtoken.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
var (
|
||||
result string
|
||||
)
|
||||
|
||||
func AuthToken() string {
|
||||
viper.SetConfigName("config")
|
||||
viper.AddConfigPath("./data")
|
||||
err := viper.ReadInConfig()
|
||||
if err != nil {
|
||||
log.Println("Error reading config for getting segfautils.auth_token", err.Error())
|
||||
}
|
||||
result := viper.GetString("segfautils.auth_token")
|
||||
return result
|
||||
}
|
19
config/hcaptchasecretkey.go
Normal file
19
config/hcaptchasecretkey.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"log"
|
||||
"strconv"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
func HCaptchaSecretKey() string {
|
||||
viper.SetConfigName("config")
|
||||
viper.AddConfigPath("./data")
|
||||
err := viper.ReadInConfig()
|
||||
if err != nil {
|
||||
log.Println("Error reading config for getting hcaptcha.secret_key", err.Error())
|
||||
}
|
||||
result := strconv.Itoa(viper.GetInt("hcaptcha.secret_key"))
|
||||
return result
|
||||
}
|
19
config/hcaptchasitekey.go
Normal file
19
config/hcaptchasitekey.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"log"
|
||||
"strconv"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
func HCaptchaSiteKey() string {
|
||||
viper.SetConfigName("config")
|
||||
viper.AddConfigPath("./data")
|
||||
err := viper.ReadInConfig()
|
||||
if err != nil {
|
||||
log.Println("Error reading config for getting hcaptcha.site_key", err.Error())
|
||||
}
|
||||
result := strconv.Itoa(viper.GetInt("hcaptcha.site_key"))
|
||||
return result
|
||||
}
|
19
config/port.go
Normal file
19
config/port.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"log"
|
||||
"strconv"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
func Port() string {
|
||||
viper.SetConfigName("config")
|
||||
viper.AddConfigPath("./data")
|
||||
err := viper.ReadInConfig()
|
||||
if err != nil {
|
||||
log.Println("Error reading config for getting segfautils.port", err.Error())
|
||||
}
|
||||
result := strconv.Itoa(viper.GetInt("segfautils.port"))
|
||||
return result
|
||||
}
|
18
config/webhook.go
Normal file
18
config/webhook.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
func WebhookURL() string {
|
||||
viper.SetConfigName("config")
|
||||
viper.AddConfigPath("./data")
|
||||
err := viper.ReadInConfig()
|
||||
if err != nil {
|
||||
log.Println("Error reading config for getting segfautils.webhook_url", err.Error())
|
||||
}
|
||||
result := viper.GetString("segfautils.webhook_url")
|
||||
return result
|
||||
}
|
Reference in New Issue
Block a user