Decorates errors and remove sentry dependency

This commit is contained in:
2022-07-19 10:24:49 +02:00
parent 936a77efe2
commit d0583cc23b
7 changed files with 28 additions and 165 deletions

View File

@ -3,6 +3,7 @@ package config
import (
"io"
"io/ioutil"
"net/http"
"time"
"github.com/pkg/errors"
@ -35,12 +36,14 @@ func NewFromFile(filepath string) (*Config, error) {
}
type HTTPConfig struct {
Address string `yaml:"address" env:"HTTP_ADDRESS"`
CookieAuthenticationKey string `yaml:"cookieAuthenticationKey" env:"HTTP_COOKIE_AUTHENTICATION_KEY"`
CookieEncryptionKey string `yaml:"cookieEncryptionKey" env:"HTTP_COOKIE_ENCRYPTION_KEY"`
CookieMaxAge int `yaml:"cookieMaxAge" env:"HTTP_COOKIE_MAX_AGE"`
TemplateDir string `yaml:"templateDir" env:"HTTP_TEMPLATE_DIR"`
PublicDir string `yaml:"publicDir" env:"HTTP_PUBLIC_DIR"`
Address string `yaml:"address" env:"HTTP_ADDRESS"`
CookieAuthenticationKey string `yaml:"cookieAuthenticationKey" env:"HTTP_COOKIE_AUTHENTICATION_KEY"`
CookieEncryptionKey string `yaml:"cookieEncryptionKey" env:"HTTP_COOKIE_ENCRYPTION_KEY"`
CookieMaxAge int `yaml:"cookieMaxAge" env:"HTTP_COOKIE_MAX_AGE"`
CookiePath string `yaml:"cookiePath" env:"HTTP_COOKIE_PATH"`
CookieSameSite http.SameSite `yaml:"cookieSameSite" env:"HTTP_COOKIE_SAME_SITE"`
TemplateDir string `yaml:"templateDir" env:"HTTP_TEMPLATE_DIR"`
PublicDir string `yaml:"publicDir" env:"HTTP_PUBLIC_DIR"`
}
type OIDCConfig struct {
@ -71,6 +74,8 @@ func NewDefault() *Config {
Address: ":3002",
CookieAuthenticationKey: "",
CookieEncryptionKey: "",
CookiePath: "/",
CookieSameSite: http.SameSiteLaxMode,
CookieMaxAge: int((time.Hour * 1).Seconds()), // 1 hour
TemplateDir: "template",
PublicDir: "public",