Documentation
¶
Index ¶
- Constants
- Variables
- func AppConfigFromYaml(yamlString string) (*appConfig, error)
- func GetAppName() string
- func GetHost() string
- func GetInsecure() bool
- func GetPort() int
- func NewAppConfig() *appConfig
- func SaveConfig() error
- func UserNewContext(ctx context.Context, u *User) context.Context
- type Settings
- type User
Constants ¶
View Source
const ( DefaultAdminUsername = "admin" DefaultAdminPassword = "password" DefaultConfigFile = "app.yaml" )
Variables ¶
View Source
var AppConfig *appConfig
View Source
var (
Viper *viper.Viper
)
globals
Functions ¶
func AppConfigFromYaml ¶
func GetAppName ¶
func GetAppName() string
func GetInsecure ¶ added in v0.2.0
func GetInsecure() bool
func NewAppConfig ¶
func NewAppConfig() *appConfig
func SaveConfig ¶
func SaveConfig() error
for the time being, viper does not support saving the config back to disk.
This is about to arrive in: https://github.com/spf13/viper/pull/287
Types ¶
type User ¶
type User struct { Id string `validate:"uuid4"` // Username is globally unique from the user's perspective. It must // either be in email address format, or the special case 'admin' Username string `validate:"required,email|eq=admin"` Name string `validate:"required,printascii"` // TODO: plan on escaping and handling all printable ASCII PasswordHash string `validate:"required"` // Hashed and Salted by the bcrypt library Role string `validate:"eq=user|eq=admin"` Phone string `validate:"phone,min=7"` }
func UserFromContext ¶
FromContext returns the User value stored in ctx, if any.
func (*User) HashPassword ¶
func (*User) ValidatePassword ¶
Click to show internal directories.
Click to hide internal directories.