Documentation ¶
Overview ¶
configuration management using a yaml configuration file You must have called LoadConfiguration() or otherwise set up the configuration before you can use these.
Index ¶
- Constants
- Variables
- func AdditionalGeneratorCommandLineFlags()
- func AdditionalInfoFieldNames() []string
- func AllowedCountries() []string
- func AllowedFlagsAdminOnly() []string
- func AllowedFlagsNoAdmin() []string
- func AllowedOptions() []string
- func AllowedPackages() []string
- func AllowedPermissions() []string
- func AllowedRegistrationLanguages() []string
- func AllowedSpokenLanguages() []string
- func AllowedStatusValues() []status.Status
- func AllowedTshirtSizes() []string
- func AnonymizeIdentity() bool
- func AuthServiceBaseUrl() string
- func AvatarBaseUrl() string
- func CorsAllowOrigin() string
- func Currency() string
- func DatabaseMysqlConnectString() string
- func DefaultFlags() string
- func DefaultOptions() string
- func DefaultPackages() string
- func DefaultRegistrationLanguage() string
- func DueDays() time.Duration
- func EarliestBirthday() string
- func EarliestDueDate() string
- func EarlyRegistrationStartTime() time.Time
- func EnableTestingMigrateDatabase()
- func FixedApiToken() string
- func FlagsConfigAdminOnly() map[string]ChoiceConfig
- func FlagsConfigNoAdmin() map[string]ChoiceConfig
- func GeneratorAccessToken() string
- func GeneratorBaseUrl() string
- func GeneratorCookieDomain() string
- func GeneratorGenerateCount() uint
- func GeneratorIdToken() string
- func GeneratorParallel() uint
- func IsCorsDisabled() bool
- func LatestBirthday() string
- func LatestDueDate() string
- func LoadTestingConfigurationFromPathOrAbort(configFilenameForTests string)
- func LoggingSeverity() string
- func MailServiceBaseUrl() string
- func MigrateDatabase() bool
- func OidcAccessTokenCookieName() string
- func OidcAdminGroup() string
- func OidcAllowedAudience() string
- func OidcAllowedIssuer() string
- func OidcEarlyRegGroup() string
- func OidcIdTokenCookieName() string
- func OidcKeySet() []*rsa.PublicKey
- func OptionsConfig() map[string]ChoiceConfig
- func PackagesConfig() map[string]ChoiceConfig
- func ParseCommandLineFlags()
- func PaymentServiceBaseUrl() string
- func PermissionsAllowingFindAttendees() []string
- func RegistrationStartTime() time.Time
- func RegsysPublicUrl() string
- func RequireLoginForReg() bool
- func ServerAddr() string
- func ServerIdleTimeout() time.Duration
- func ServerReadTimeout() time.Duration
- func ServerWriteTimeout() time.Duration
- func StartupLoadConfiguration() error
- func UseEcsLogging() bool
- func VatPercent() float64
- type AddInfoConfig
- type Application
- type BirthdayConfig
- type ChoiceConfig
- type CorsConfig
- type DatabaseConfig
- type DatabaseType
- type DuesConfig
- type FindApiAccessConfig
- type FixedTokenConfig
- type FlagsPkgOptConfig
- type GoLiveConfig
- type LogStyle
- type LoggingConfig
- type OpenIdConnectConfig
- type SecurityConfig
- type ServerConfig
- type ServiceConfig
Constants ¶
const ( Inmemory DatabaseType = "inmemory" Mysql DatabaseType = "mysql" Plain LogStyle = "plain" ECS LogStyle = "ecs" // default )
const HumanDateFormat = "02.01.2006"
const IsoDateFormat = "2006-01-02"
const StartTimeFormat = "2006-01-02T15:04:05-07:00"
Variables ¶
var ( ErrorConfigArgumentMissing = errors.New("configuration file argument missing. Please specify using -config argument. Aborting") ErrorConfigFile = errors.New("failed to read or parse configuration file. Aborting") )
Functions ¶
func AdditionalGeneratorCommandLineFlags ¶ added in v0.1.1
func AdditionalGeneratorCommandLineFlags()
func AdditionalInfoFieldNames ¶
func AdditionalInfoFieldNames() []string
func AllowedCountries ¶
func AllowedCountries() []string
func AllowedFlagsAdminOnly ¶
func AllowedFlagsAdminOnly() []string
func AllowedFlagsNoAdmin ¶
func AllowedFlagsNoAdmin() []string
func AllowedOptions ¶
func AllowedOptions() []string
func AllowedPackages ¶
func AllowedPackages() []string
func AllowedPermissions ¶
func AllowedPermissions() []string
AllowedPermissions returns a sorted unique list of all permissions referenced in additional info configurations or configured to have access to the find api.
func AllowedRegistrationLanguages ¶
func AllowedRegistrationLanguages() []string
func AllowedSpokenLanguages ¶
func AllowedSpokenLanguages() []string
func AllowedStatusValues ¶
func AllowedTshirtSizes ¶
func AllowedTshirtSizes() []string
func AnonymizeIdentity ¶ added in v0.1.1
func AnonymizeIdentity() bool
func AuthServiceBaseUrl ¶
func AuthServiceBaseUrl() string
func AvatarBaseUrl ¶ added in v0.1.9
func AvatarBaseUrl() string
func CorsAllowOrigin ¶
func CorsAllowOrigin() string
func DatabaseMysqlConnectString ¶
func DatabaseMysqlConnectString() string
func DefaultFlags ¶
func DefaultFlags() string
func DefaultOptions ¶
func DefaultOptions() string
func DefaultPackages ¶
func DefaultPackages() string
func DefaultRegistrationLanguage ¶
func DefaultRegistrationLanguage() string
func EarliestBirthday ¶
func EarliestBirthday() string
func EarliestDueDate ¶
func EarliestDueDate() string
func EnableTestingMigrateDatabase ¶
func EnableTestingMigrateDatabase()
EnableTestingMigrateDatabase is for tests
func FixedApiToken ¶
func FixedApiToken() string
func FlagsConfigAdminOnly ¶
func FlagsConfigAdminOnly() map[string]ChoiceConfig
func FlagsConfigNoAdmin ¶
func FlagsConfigNoAdmin() map[string]ChoiceConfig
func GeneratorAccessToken ¶ added in v0.1.1
func GeneratorAccessToken() string
func GeneratorBaseUrl ¶ added in v0.1.1
func GeneratorBaseUrl() string
func GeneratorCookieDomain ¶ added in v0.1.1
func GeneratorCookieDomain() string
func GeneratorGenerateCount ¶ added in v0.1.1
func GeneratorGenerateCount() uint
func GeneratorIdToken ¶ added in v0.1.1
func GeneratorIdToken() string
func GeneratorParallel ¶ added in v0.1.1
func GeneratorParallel() uint
func IsCorsDisabled ¶
func IsCorsDisabled() bool
func LatestBirthday ¶
func LatestBirthday() string
func LatestDueDate ¶
func LatestDueDate() string
func LoadTestingConfigurationFromPathOrAbort ¶
func LoadTestingConfigurationFromPathOrAbort(configFilenameForTests string)
LoadTestingConfigurationFromPathOrAbort is for tests to set a hardcoded yaml configuration
func LoggingSeverity ¶
func LoggingSeverity() string
func MailServiceBaseUrl ¶
func MailServiceBaseUrl() string
func MigrateDatabase ¶
func MigrateDatabase() bool
func OidcAccessTokenCookieName ¶
func OidcAccessTokenCookieName() string
func OidcAdminGroup ¶
func OidcAdminGroup() string
func OidcAllowedAudience ¶
func OidcAllowedAudience() string
func OidcAllowedIssuer ¶
func OidcAllowedIssuer() string
func OidcEarlyRegGroup ¶
func OidcEarlyRegGroup() string
func OidcIdTokenCookieName ¶
func OidcIdTokenCookieName() string
func OidcKeySet ¶
func OptionsConfig ¶
func OptionsConfig() map[string]ChoiceConfig
func PackagesConfig ¶
func PackagesConfig() map[string]ChoiceConfig
func ParseCommandLineFlags ¶
func ParseCommandLineFlags()
ParseCommandLineFlags is exposed separately so you can skip it for tests
func PaymentServiceBaseUrl ¶
func PaymentServiceBaseUrl() string
func PermissionsAllowingFindAttendees ¶ added in v0.1.6
func PermissionsAllowingFindAttendees() []string
func RegistrationStartTime ¶
func RegsysPublicUrl ¶
func RegsysPublicUrl() string
func RequireLoginForReg ¶
func RequireLoginForReg() bool
func ServerAddr ¶
func ServerAddr() string
func ServerIdleTimeout ¶
func ServerReadTimeout ¶
func ServerWriteTimeout ¶
func StartupLoadConfiguration ¶
func StartupLoadConfiguration() error
func UseEcsLogging ¶
func UseEcsLogging() bool
func VatPercent ¶
func VatPercent() float64
Types ¶
type AddInfoConfig ¶
type AddInfoConfig struct { SelfRead bool `yaml:"self_read"` SelfWrite bool `yaml:"self_write"` Permissions []string `yaml:"permissions"` // name of permission (in admin info) to grant access }
AddInfoConfig configures access permissions to an additional info field
func AdditionalInfoConfiguration ¶
func AdditionalInfoConfiguration(fieldName string) AddInfoConfig
type Application ¶
type Application struct { Service ServiceConfig `yaml:"service"` Server ServerConfig `yaml:"server"` Database DatabaseConfig `yaml:"database"` Security SecurityConfig `yaml:"security"` Logging LoggingConfig `yaml:"logging"` Choices FlagsPkgOptConfig `yaml:"choices"` AdditionalInfo map[string]AddInfoConfig `yaml:"additional_info_areas"` // field name -> config TShirtSizes []string `yaml:"tshirtsizes"` Birthday BirthdayConfig `yaml:"birthday"` GoLive GoLiveConfig `yaml:"go_live"` Dues DuesConfig `yaml:"dues"` Countries []string `yaml:"countries"` SpokenLanguages []string `yaml:"spoken_languages"` RegistrationLanguages []string `yaml:"registration_languages"` Currency string `yaml:"currency"` VatPercent float64 `yaml:"vat_percent"` // used for manual dues }
Application is the root configuration type
func Configuration ¶
func Configuration() *Application
type BirthdayConfig ¶
BirthdayConfig is used for validation of attendee supplied birthday
use it to exclude nonsensical values, or to exclude participants under a minimum age
type ChoiceConfig ¶
type ChoiceConfig struct { AllowedCounts []int `yaml:"allowed_counts"` // only supported for packages, ignored unless you also set max_count Description string `yaml:"description"` Price int64 `yaml:"price"` VatPercent float64 `yaml:"vat_percent"` Default bool `yaml:"default"` // if set to true, is added to flags by default. Not available for admin only flags! AdminOnly bool `yaml:"admin_only"` // this flag is kept under the adminInfo structure, so it is not visible to users ReadOnly bool `yaml:"read_only"` // this flag is kept under the normal flags, thus visible to end user, but only admin can change it VisibleFor []string `yaml:"visible_for"` // list of permissions which allow seeing the flag/option/package. Admin can always see everything, "self" can always see non-admin_only, but you can add it for admin_only fields. This field also controls who else can see the info based on their permissions admin field. Example: "self,sponsordesk" Group string `yaml:"group"` // set if attendee has this group during initial registration Mandatory bool `yaml:"at-least-one-mandatory"` // one of these MUST be chosen (no constraint if not set on any choices) MaxCount int `yaml:"max_count"` // only supported for packages, 0 means 1 so can be left out of config Constraint string `yaml:"constraint"` ConstraintMsg string `yaml:"constraint_msg"` }
type CorsConfig ¶
type DatabaseConfig ¶
type DatabaseConfig struct { Use DatabaseType `yaml:"use"` Username string `yaml:"username"` Password string `yaml:"password"` Database string `yaml:"database"` Parameters []string `yaml:"parameters"` }
DatabaseConfig configures which db to use (mysql, inmemory) and how to connect to it (needed for mysql only)
type DuesConfig ¶
type DuesConfig struct { EarliestDueDate string `yaml:"earliest_due_date"` LatestDueDate string `yaml:"latest_due_date"` // inclusive DueDays int `yaml:"due_days"` }
DuesConfig configures the due date calculations
type FindApiAccessConfig ¶ added in v0.1.6
type FindApiAccessConfig struct {
Permissions []string `yaml:"permissions"` // the list of permissions that grant access to the FindAttendees endpoint
}
type FixedTokenConfig ¶
type FixedTokenConfig struct {
Api string `yaml:"api"` // shared-secret for server-to-server backend authentication
}
type FlagsPkgOptConfig ¶
type FlagsPkgOptConfig struct { Flags map[string]ChoiceConfig `yaml:"flags"` Packages map[string]ChoiceConfig `yaml:"packages"` Options map[string]ChoiceConfig `yaml:"options"` }
FlagsPkgOptConfig configures the choices available to the attendees
flags are choices that have some impact on how the registration is treated (guest, e.V. membership, staff, ...)
packages are stuff that costs money, such as sponsorship or housing options
options are personal preferences (interested in music, fursuiter, ...) that do not affect how the registration is treated.
type GoLiveConfig ¶
type GoLiveConfig struct { StartIsoDatetime string `yaml:"start_iso_datetime"` EarlyRegStartIsoDatetime string `yaml:"early_reg_start_iso_datetime"` // optional, only useful if you also set early_reg_role }
GoLiveConfig configures the time at which registration becomes available
type LoggingConfig ¶
LoggingConfig configures logging
type OpenIdConnectConfig ¶
type OpenIdConnectConfig struct { IdTokenCookieName string `yaml:"id_token_cookie_name"` // optional, but must both be set, then tokens are read from cookies AccessTokenCookieName string `yaml:"access_token_cookie_name"` // optional, but must both be set, then tokens are read from cookies TokenPublicKeysPEM []string `yaml:"token_public_keys_PEM"` // a list of public RSA keys in PEM format, see https://github.com/Jumpy-Squirrel/jwks2pem for obtaining PEM from openid keyset endpoint AdminGroup string `yaml:"admin_group"` // the group claim that supplies regsys admin rights EarlyRegGroup string `yaml:"early_reg_group"` // optional, the group claim that turns on early registration Audience string `yaml:"audience"` Issuer string `yaml:"issuer"` AvatarBaseUrl string `yaml:"avatar_base_url"` // optional, prefix for the avatar from the JWT id token }
type SecurityConfig ¶
type SecurityConfig struct { Fixed FixedTokenConfig `yaml:"fixed_token"` Oidc OpenIdConnectConfig `yaml:"oidc"` Cors CorsConfig `yaml:"cors"` RequireLogin bool `yaml:"require_login_for_reg"` AnonymizeIdentity bool `yaml:"anonymize_identity"` FindApiAccess FindApiAccessConfig `yaml:"find_api_access"` }
SecurityConfig configures everything related to security
type ServerConfig ¶
type ServerConfig struct { Address string `yaml:"address"` Port string `yaml:"port"` ReadTimeout int `yaml:"read_timeout_seconds"` WriteTimeout int `yaml:"write_timeout_seconds"` IdleTimeout int `yaml:"idle_timeout_seconds"` }
ServerConfig contains all values for http configuration
type ServiceConfig ¶
type ServiceConfig struct { Name string `yaml:"name"` RegsysPublicUrl string `yaml:"regsys_public_url"` // used in emails PaymentService string `yaml:"payment_service"` // base url, usually http://localhost:nnnn, will use in-memory-mock if unset MailService string `yaml:"mail_service"` // base url, usually http://localhost:nnnn, will use in-memory-mock if unset AuthService string `yaml:"auth_service"` // base url, usually http://localhost:nnnn, will skip userinfo checks if unset }
ServiceConfig contains configuration values for service related tasks. E.g. URLs to downstream services