Compare commits

..

No commits in common. "c1611114d07527162e3e841deb78627edc4b08fc" and "a9af73b557d2d32412c0713041789d5b1f6b7059" have entirely different histories.

4 changed files with 2 additions and 13 deletions

View file

@ -13,8 +13,6 @@
use `hlog.FromRequest` to get a logger instance prepared with a bunch of metadata use `hlog.FromRequest` to get a logger instance prepared with a bunch of metadata
- As Linstrom is both intended for active use as well as providing a learning resource, - As Linstrom is both intended for active use as well as providing a learning resource,
all functions and structs must be documented all functions and structs must be documented
- Errors returned from public functions must be wrapped with `git.mstar.dev/mstar/goutils/other.Error`
and given appropriate descriptive information
## JS/TS ## JS/TS

View file

@ -4,9 +4,9 @@ import (
"fmt" "fmt"
"os" "os"
"git.mstar.dev/mstar/goutils/other"
"github.com/BurntSushi/toml" "github.com/BurntSushi/toml"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"git.mstar.dev/mstar/goutils/other"
) )
type ConfigSSL struct { type ConfigSSL struct {
@ -68,9 +68,6 @@ type ConfigStorage struct {
MaxInMemoryCacheTTL int `toml:"max_in_memory_cache_ttl"` MaxInMemoryCacheTTL int `toml:"max_in_memory_cache_ttl"`
// The time to live for items in redis, in seconds // The time to live for items in redis, in seconds
MaxRedisCacheTTL *int `toml:"max_redis_cache_ttl"` MaxRedisCacheTTL *int `toml:"max_redis_cache_ttl"`
// Key used for encrypting sensitive information in the db
// DO NOT CHANGE THIS AFTER SETUP
EncryptionKey string `toml:"encryption_key"`
} }
type ConfigS3 struct { type ConfigS3 struct {
@ -148,7 +145,6 @@ var defaultConfig Config = Config{
MaxInMemoryCacheSize: 1e6, // 1 Megabyte MaxInMemoryCacheSize: 1e6, // 1 Megabyte
MaxInMemoryCacheTTL: 5, MaxInMemoryCacheTTL: 5,
MaxRedisCacheTTL: nil, MaxRedisCacheTTL: nil,
EncryptionKey: "Encryption key for sensitive information. DO NOT CHANGE THIS AFTER SETUP",
}, },
Mail: ConfigMail{ Mail: ConfigMail{
Host: "localhost", Host: "localhost",

View file

@ -30,7 +30,6 @@ func newUserAuthMethod(db *gorm.DB, opts ...gen.DOOption) userAuthMethod {
_userAuthMethod.UserId = field.NewString(tableName, "user_id") _userAuthMethod.UserId = field.NewString(tableName, "user_id")
_userAuthMethod.AuthMethod = field.NewField(tableName, "auth_method") _userAuthMethod.AuthMethod = field.NewField(tableName, "auth_method")
_userAuthMethod.Token = field.NewBytes(tableName, "token") _userAuthMethod.Token = field.NewBytes(tableName, "token")
_userAuthMethod.Name = field.NewString(tableName, "name")
_userAuthMethod.User = userAuthMethodBelongsToUser{ _userAuthMethod.User = userAuthMethodBelongsToUser{
db: db.Session(&gorm.Session{}), db: db.Session(&gorm.Session{}),
@ -185,7 +184,6 @@ type userAuthMethod struct {
UserId field.String UserId field.String
AuthMethod field.Field AuthMethod field.Field
Token field.Bytes Token field.Bytes
Name field.String
User userAuthMethodBelongsToUser User userAuthMethodBelongsToUser
fieldMap map[string]field.Expr fieldMap map[string]field.Expr
@ -207,7 +205,6 @@ func (u *userAuthMethod) updateTableName(table string) *userAuthMethod {
u.UserId = field.NewString(table, "user_id") u.UserId = field.NewString(table, "user_id")
u.AuthMethod = field.NewField(table, "auth_method") u.AuthMethod = field.NewField(table, "auth_method")
u.Token = field.NewBytes(table, "token") u.Token = field.NewBytes(table, "token")
u.Name = field.NewString(table, "name")
u.fillFieldMap() u.fillFieldMap()
@ -224,12 +221,11 @@ func (u *userAuthMethod) GetFieldByName(fieldName string) (field.OrderExpr, bool
} }
func (u *userAuthMethod) fillFieldMap() { func (u *userAuthMethod) fillFieldMap() {
u.fieldMap = make(map[string]field.Expr, 6) u.fieldMap = make(map[string]field.Expr, 5)
u.fieldMap["id"] = u.ID u.fieldMap["id"] = u.ID
u.fieldMap["user_id"] = u.UserId u.fieldMap["user_id"] = u.UserId
u.fieldMap["auth_method"] = u.AuthMethod u.fieldMap["auth_method"] = u.AuthMethod
u.fieldMap["token"] = u.Token u.fieldMap["token"] = u.Token
u.fieldMap["name"] = u.Name
} }

View file

@ -13,5 +13,4 @@ type UserAuthMethod struct {
UserId string UserId string
AuthMethod AuthenticationMethodType `gorm:"type:auth_method_type"` AuthMethod AuthenticationMethodType `gorm:"type:auth_method_type"`
Token []byte Token []byte
Name string
} }