Documentation
¶
Overview ¶
Package config provides configuration management
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultConfig ¶ added in v0.0.4
func DefaultConfig()
DefaultConfig sets the default values for the configuration
func GetDbURI ¶ added in v0.0.4
func GetDbURI() string
GetDbURI returns a database connection string
func GetServerAddress ¶ added in v0.0.4
func GetServerAddress() string
GetServerAddress returns the address string to bind the service to
func InitConfig ¶ added in v0.0.4
func InitConfig(configFile string)
InitConfig initializes the configuration
Types ¶
type K ¶ added in v0.0.4
type K string
K is a type alias for string
const ( // ServiceHost is the host to bind the service to ServiceHost K = `service.host` // ServicePort is the port to bind the service to ServicePort K = `service.port` // ServiceBaseURL is the base URL of the service ServiceBaseURL K = `service.base_url` // ServiceAPIPrefix is the prefix to use for the API set to "" for / ServiceAPIPrefix K = `service.api_prefix` // ServiceJWTSigningMethod is the signing method to use for JWT ServiceJWTSigningMethod K = `service.jwt.signing_method` // ServiceJWTSigningSecret is the secret to use for JWT (only for HS256) //nolint:gosec // False positive: this is a configuration key name, not a credential ServiceJWTSigningSecret K = `service.jwt.signing_secret` // ServiceJWTSigningKey is the key to use for JWT (only for RS256) ServiceJWTSigningKey K = `service.jwt.signing_key` // ServiceJWTPublicKey is the public key to use for JWT (only for RS256) ServiceJWTPublicKey K = `service.jwt.public_key` // ServiceJWTRefreshSigningSecret is the secret to use for JWT refresh token (only for HS256) //nolint:gosec // False positive: this is a configuration key name, not a credential ServiceJWTRefreshSigningSecret K = `service.jwt.refresh_signing_secret` // ServiceJWTRefreshSigningKey is the key to use for JWT refresh token (only for RS256) ServiceJWTRefreshSigningKey K = `service.jwt.refresh_signing_key` // ServiceJWTRefreshPublicKey is the public key to use for JWT refresh token (only for RS256) ServiceJWTRefreshPublicKey K = `service.jwt.refresh_public_key` // TotpSkew is the skew to use for TOTP (max 255) ServiceTotpSkew K = `service.totp.skew` // ServiceBackupCodesEncryptionKey is the encryption key for backup codes //nolint:gosec // False positive: this is a configuration key name, not a credential ServiceBackupCodesEncryptionKey K = `service.backup_codes.encryption_key` // ReCAPTCHA configuration // ServiceReCAPTCHAEnabled enables or disables reCAPTCHA verification ServiceReCAPTCHAEnabled K = `service.recaptcha.enabled` // ServiceReCAPTCHASecretKey is the secret key for reCAPTCHA verification ServiceReCAPTCHASecretKey K = `service.recaptcha.secret_key` // ServiceReCAPTCHAMinScore is the minimum score threshold for reCAPTCHA verification (0.0 to 1.0) ServiceReCAPTCHAMinScore K = `service.recaptcha.min_score` // ServiceReCAPTCHAFieldName is the field name in the JSON payload containing the reCAPTCHA token ServiceReCAPTCHAFieldName K = `service.recaptcha.field_name` // CORS configuration // ServiceCorsAllowedOrigins is the list of allowed origins ServiceCorsAllowOrigins K = `service.cors.allowed_origins` // ServiceCorsAllowMethods is the list of allowed methods ServiceCorsAllowMethods K = `service.cors.allow_methods` // ServviceCorsCredentials is whether to allow credentials in a CORS request ServiceCorsAllowCredentials K = `service.cors.allow_credentials` // ServiceCorsMaxAge is the max age of the CORS response ServiceCorsMaxAge K = `service.cors.max_age` // Cookie options // ServiceCookieSameSiteNone is whether to set SameSite=None in a cookie ServiceCookieSameSiteNone K = `service.cookie.same_site_none` // ServiceMailEnabled controls whether the mail service is enabled ServiceMailEnabled K = `service.mail.enabled` // ServiceMailWorkers is the number of mail worker goroutines to run ServiceMailWorkers K = `service.mail.workers` // ServiceMailTemplateDir is the directory containing email templates ServiceMailTemplateDir K = `service.mail.template_dir` // ServiceMailDefaultTemplate is the default template to use for emails ServiceMailDefaultTemplate K = `service.mail.default_template` // ServiceShutdownTimeoutSeconds is the timeout in seconds for graceful shutdown ServiceShutdownTimeoutSeconds K = `service.shutdown_timeout_seconds` // HTTP Server timeout configurations // ServiceHTTPReadHeaderTimeoutSeconds is the timeout for reading request headers ServiceHTTPReadHeaderTimeoutSeconds K = `service.http.read_header_timeout_seconds` // ServiceHTTPReadTimeoutSeconds is the timeout for reading the entire request ServiceHTTPReadTimeoutSeconds K = `service.http.read_timeout_seconds` // ServiceHTTPWriteTimeoutSeconds is the timeout for writing the response ServiceHTTPWriteTimeoutSeconds K = `service.http.write_timeout_seconds` //nolint:gosec // G101: This is a configuration key, not a credential // ServiceHTTPIdleTimeoutSeconds is the timeout for keep-alive connections ServiceHTTPIdleTimeoutSeconds K = `service.http.idle_timeout_seconds` // ServiceDevMode indicates if the service is running in development mode ServiceDevMode K = `service.dev_mode` // ServicePendingUserExpirationHours is the number of hours a pending user registration is valid ServicePendingUserExpirationHours K = `service.pending_user_expiration_hours` // DatabaseHost is the host to connect to the database DatabaseHost K = `database.host` // DatabasePort is the port to connect to the database DatabasePort K = `database.port` // DatabaseUsername is the username to connect to the database DatabaseUsername K = `database.username` // DatabasePassword is the password to connect to the database DatabasePassword K = `database.password` // DatabaseName is the name of the database to connect to DatabaseName K = `database.name` // DatabaseAutoMigration is whether to automatically apply the migrations to the database DatabaseAutoMigration K = `database.auto_migration` // RedisHost is the host to connect to the redis RedisHost K = `redis.host` // RedisPort is the port to connect to the redis RedisPort K = `redis.port` // RedisPassword is the password to connect to the redis RedisPassword K = `redis.password` // RedisDatabase is the database to connect to the redis RedisDatabase K = `redis.database` // SMTPHost is the host of the SMTP server SMTPHost K = `smtp.host` // SMTPPort is the port of the SMTP server SMTPPort K = `smtp.port` // SMTPUsername is the username for SMTP authentication SMTPUsername K = `smtp.username` // SMTPPassword is the password for SMTP authentication SMTPPassword K = `smtp.password` // SMTPUseTLS determines if TLS should be used for SMTP SMTPUseTLS K = `smtp.use_tls` // SMTPFromEmail is the default from email address SMTPFromEmail K = `smtp.from_email` // SMTPFromName is the default from name SMTPFromName K = `smtp.from_name` // Password Reset Token configuration // ServicePasswordResetTokenLength is the length of generated password reset tokens ServicePasswordResetTokenLength K = `service.password_reset.token_length` // ServicePasswordResetTokenLifetimeMinutes is how long password reset tokens are valid in minutes ServicePasswordResetTokenLifetimeMinutes K = `service.password_reset.token_lifetime_minutes` // ServicePasswordResetCleanupIntervalHours is how often to clean up expired tokens in hours ServicePasswordResetCleanupIntervalHours K = `service.password_reset.cleanup_interval_hours` // ServicePasswordResetMaxTokensPerUser is the maximum number of active tokens per user ServicePasswordResetMaxTokensPerUser K = `service.password_reset.max_tokens_per_user` // Cron configuration // ServiceCronEnabled controls whether the cron service is enabled ServiceCronEnabled K = `service.cron.enabled` // ServiceCronPasswordResetCleanup is the cron expression for password reset token cleanup ServiceCronPasswordResetCleanup K = `service.cron.password_reset_cleanup` // ServiceCronTimeZone is the timezone for cron jobs ServiceCronTimeZone K = `service.cron.timezone` // OpenTelemetry configuration // TelemetryEnabled controls whether OpenTelemetry is enabled TelemetryEnabled K = `telemetry.enabled` // TelemetryServiceName is the service name for OpenTelemetry TelemetryServiceName K = `telemetry.service_name` // TelemetryServiceVersion is the service version for OpenTelemetry TelemetryServiceVersion K = `telemetry.service_version` // TelemetryOTLPEndpoint is the OTLP exporter endpoint TelemetryOTLPEndpoint K = `telemetry.otlp.endpoint` // TelemetryOTLPHeaders are the headers for OTLP exporter TelemetryOTLPHeaders K = `telemetry.otlp.headers` // TelemetryOTLPInsecure controls whether to use insecure OTLP connection TelemetryOTLPInsecure K = `telemetry.otlp.insecure` // TelemetryPrometheusEnabled controls whether Prometheus metrics are enabled TelemetryPrometheusEnabled K = `telemetry.prometheus.enabled` // TelemetryPrometheusEndpoint is the Prometheus metrics endpoint path TelemetryPrometheusEndpoint K = `telemetry.prometheus.endpoint` // TelemetryJaegerEnabled controls whether Jaeger tracing is enabled TelemetryJaegerEnabled K = `telemetry.jaeger.enabled` // TelemetryJaegerEndpoint is the Jaeger endpoint TelemetryJaegerEndpoint K = `telemetry.jaeger.endpoint` // TelemetryTracingEnabled controls whether distributed tracing is enabled TelemetryTracingEnabled K = `telemetry.tracing.enabled` // TelemetryTracingSampleRate is the trace sampling rate (0.0 to 1.0) TelemetryTracingSampleRate K = `telemetry.tracing.sample_rate` // TelemetryMetricsEnabled controls whether metrics collection is enabled TelemetryMetricsEnabled K = `telemetry.metrics.enabled` // TelemetryMetricsInterval is the metrics collection interval in seconds TelemetryMetricsInterval K = `telemetry.metrics.interval` // TelemetryResourceAttributes are additional resource attributes TelemetryResourceAttributes K = `telemetry.resource.attributes` // Channel Registration configuration // ServiceChannelRegEnabled controls whether channel registration is enabled ServiceChannelRegEnabled K = `service.channel_registration.enabled` // ServiceChannelRegAllowMultiple controls whether users can register multiple channels ServiceChannelRegAllowMultiple K = `service.channel_registration.allow_multiple` // ServiceChannelRegRequiredSupporters is the number of supporters required for channel registration ServiceChannelRegRequiredSupporters K = `service.channel_registration.required_supporters` // ServiceChannelRegCooldownHours is the cooldown period between channel registrations in hours ServiceChannelRegCooldownHours K = `service.channel_registration.cooldown_hours` // ServiceChannelRegMaxChannelsRegular is the maximum channels for regular users ServiceChannelRegMaxChannelsRegular K = `service.channel_registration.max_channels_regular` // ServiceChannelRegMaxChannelsSupporter is the maximum channels for supporter users ServiceChannelRegMaxChannelsSupporter K = `service.channel_registration.max_channels_supporter` // ServiceChannelRegMaxChannelsAdmin is the maximum channels for admin users ServiceChannelRegMaxChannelsAdmin K = `service.channel_registration.max_channels_admin` // ServiceChannelRegIrcIdleHours is the maximum IRC idle time in hours before restricting registration ServiceChannelRegIrcIdleHours K = `service.channel_registration.irc_idle_hours` // ServiceChannelRegLockedEmailDomains is the list of email domains that are locked for channel registration ServiceChannelRegLockedEmailDomains K = `service.channel_registration.locked_email_domains` // ServiceChannelRegLockedEmailPatterns is the list of email patterns that are locked for channel registration ServiceChannelRegLockedEmailPatterns K = `service.channel_registration.locked_email_patterns` // ServiceChannelRegMinDaysBeforeReg is the minimum days a user account must exist before registering a channel ServiceChannelRegMinDaysBeforeReg K = `service.channel_registration.min_days_before_reg` // ServiceChannelRegMinDaysBeforeSupport is the minimum days a supporter account must exist ServiceChannelRegMinDaysBeforeSupport K = `service.channel_registration.min_days_before_support` // ServiceChannelRegMaxConcurrentSupports is the maximum number of channels a user can support concurrently ServiceChannelRegMaxConcurrentSupports K = `service.channel_registration.max_concurrent_supports` // Rate Limiting configuration // ServiceRateLimitEnabled controls whether rate limiting is enabled ServiceRateLimitEnabled K = `service.rate_limit.enabled` // ServiceRateLimitRequestsPerMinute is the number of requests allowed per minute ServiceRateLimitRequestsPerMinute K = `service.rate_limit.requests_per_minute` // ServiceRateLimitBurstSize is the burst size for rate limiting ServiceRateLimitBurstSize K = `service.rate_limit.burst_size` // ServiceRateLimitWindowMinutes is the time window for rate limiting in minutes ServiceRateLimitWindowMinutes K = `service.rate_limit.window_minutes` // ServiceRateLimitMode controls the rate limiting mode: "global", "endpoints", or "channels" ServiceRateLimitMode K = `service.rate_limit.mode` // ServiceRateLimitEndpoints is a list of endpoint patterns to rate limit ServiceRateLimitEndpoints K = `service.rate_limit.endpoints` )
func (K) GetFloat64 ¶ added in v0.0.11
GetFloat64 returns the value of the key as a float64
func (K) GetStringSlice ¶ added in v0.0.8
GetStringSlice returns the value of the key as a string slice
Click to show internal directories.
Click to hide internal directories.