Documentation ¶
Overview ¶
Package config provides configuration structs for every service
Index ¶
- Constants
- Variables
- type CloserFunc
- type InstanceConfig
- func GetAPIServerConfigFromGoogleCloudRunEnvironment(ctx context.Context, client SecretVersionAccessor) (*InstanceConfig, error)
- func GetDataChangesWorkerConfigFromGoogleCloudSecretManager(ctx context.Context) (*InstanceConfig, error)
- func GetEmailProberConfigFromGoogleCloudSecretManager(ctx context.Context) (*InstanceConfig, error)
- func GetOutboundEmailerConfigFromGoogleCloudSecretManager(ctx context.Context) (*InstanceConfig, error)
- func GetSearchDataIndexSchedulerConfigFromGoogleCloudSecretManager(ctx context.Context) (*InstanceConfig, error)
- func GetSearchDataIndexerConfigFromGoogleCloudSecretManager(ctx context.Context) (*InstanceConfig, error)
- type MetaSettings
- type SecretVersionAccessor
- type ServicesConfig
Constants ¶
const ( // DevelopmentRunMode is the run mode for a development environment. DevelopmentRunMode runMode = "development" // TestingRunMode is the run mode for a testing environment. TestingRunMode runMode = "testing" // ProductionRunMode is the run mode for a production environment. ProductionRunMode runMode = "production" )
Variables ¶
var ( // ServiceConfigProviders represents this package's offering to the dependency injector. ServiceConfigProviders = wire.NewSet( wire.FieldsOf( new(*InstanceConfig), "Observability", "Email", "Analytics", "FeatureFlags", "Encoding", "Routing", "Database", "Meta", "Events", "Search", "Server", "Services", ), wire.FieldsOf( new(*ServicesConfig), "AuditLogEntries", "Auth", "Accounts", "AccountInvitations", "ServiceSettings", "ServiceSettingConfigurations", "Users", "UserNotifications", "Webhooks", "Workers", ), ) )
Functions ¶
This section is empty.
Types ¶
type InstanceConfig ¶
type InstanceConfig struct { Observability observability.Config `json:"observability" toml:"observability,omitempty"` Email emailconfig.Config `json:"email" toml:"email,omitempty"` Analytics analyticsconfig.Config `json:"analytics" toml:"analytics,omitempty"` Search searchcfg.Config `json:"search" toml:"search,omitempty"` FeatureFlags featureflagsconfig.Config `json:"featureFlags" toml:"events,omitempty"` Encoding encoding.Config `json:"encoding" toml:"encoding,omitempty"` Meta MetaSettings `json:"meta" toml:"meta,omitempty"` Routing routing.Config `json:"routing" toml:"routing,omitempty"` Events msgconfig.Config `json:"events" toml:"events,omitempty"` Server http.Config `json:"server" toml:"server,omitempty"` Database dbconfig.Config `json:"database" toml:"database,omitempty"` Services ServicesConfig `json:"services" toml:"services,omitempty"` // contains filtered or unexported fields }
InstanceConfig configures an instance of the service. It is composed of all the other setting structs.
func GetAPIServerConfigFromGoogleCloudRunEnvironment ¶
func GetAPIServerConfigFromGoogleCloudRunEnvironment(ctx context.Context, client SecretVersionAccessor) (*InstanceConfig, error)
GetAPIServerConfigFromGoogleCloudRunEnvironment fetches an InstanceConfig from GCP Secret Manager.
func GetDataChangesWorkerConfigFromGoogleCloudSecretManager ¶
func GetDataChangesWorkerConfigFromGoogleCloudSecretManager(ctx context.Context) (*InstanceConfig, error)
GetDataChangesWorkerConfigFromGoogleCloudSecretManager fetches an InstanceConfig from GCP Secret Manager.
func GetEmailProberConfigFromGoogleCloudSecretManager ¶
func GetEmailProberConfigFromGoogleCloudSecretManager(ctx context.Context) (*InstanceConfig, error)
GetEmailProberConfigFromGoogleCloudSecretManager fetches an InstanceConfig from GCP Secret Manager.
func GetOutboundEmailerConfigFromGoogleCloudSecretManager ¶
func GetOutboundEmailerConfigFromGoogleCloudSecretManager(ctx context.Context) (*InstanceConfig, error)
GetOutboundEmailerConfigFromGoogleCloudSecretManager fetches an InstanceConfig from GCP Secret Manager.
func GetSearchDataIndexSchedulerConfigFromGoogleCloudSecretManager ¶
func GetSearchDataIndexSchedulerConfigFromGoogleCloudSecretManager(ctx context.Context) (*InstanceConfig, error)
GetSearchDataIndexSchedulerConfigFromGoogleCloudSecretManager fetches an InstanceConfig from GCP Secret Manager.
func GetSearchDataIndexerConfigFromGoogleCloudSecretManager ¶
func GetSearchDataIndexerConfigFromGoogleCloudSecretManager(ctx context.Context) (*InstanceConfig, error)
GetSearchDataIndexerConfigFromGoogleCloudSecretManager fetches an InstanceConfig from GCP Secret Manager.
func (*InstanceConfig) Commit ¶
func (cfg *InstanceConfig) Commit() string
func (*InstanceConfig) EncodeToFile ¶
EncodeToFile renders your config to a file given your favorite encoder.
func (*InstanceConfig) ValidateWithContext ¶
func (cfg *InstanceConfig) ValidateWithContext(ctx context.Context, validateServices bool) error
ValidateWithContext validates a InstanceConfig struct.
type MetaSettings ¶
type MetaSettings struct { RunMode runMode `json:"runMode" toml:"run_mode,omitempty"` Debug bool `json:"debug" toml:"debug,omitempty"` }
MetaSettings is primarily used for development.
func (MetaSettings) ValidateWithContext ¶
func (s MetaSettings) ValidateWithContext(ctx context.Context) error
ValidateWithContext validates an MetaSettings struct.
type SecretVersionAccessor ¶
type SecretVersionAccessor interface {
AccessSecretVersion(ctx context.Context, req *secretmanagerpb.AccessSecretVersionRequest, opts ...gax.CallOption) (*secretmanagerpb.AccessSecretVersionResponse, error)
}
SecretVersionAccessor is an interface abstraction of the GCP Secret Manager API call we use during config hydration. This interface exists for testing purposes. Yes, you're not supposed to write arbitrary interfaces for testing. Yes I'm still doing it.
type ServicesConfig ¶
type ServicesConfig struct { AuditLogEntries auditlogentriesservice.Config `json:"auditLogEntries" toml:"audit_log_entries,omitempty"` ServiceSettingConfigurations servicesettingconfigurationsservice.Config `json:"serviceSettingConfigurations" toml:"service_setting_configurations,omitempty"` ServiceSettings servicesettingsservice.Config `json:"serviceSettings" toml:"service_settings,omitempty"` Accounts accountsservice.Config `json:"accounts" toml:"accounts,omitempty"` UserNotifications usernotificationsservice.Config `json:"userNotifications" toml:"user_notifications,omitempty"` Users usersservice.Config `json:"users" toml:"users,omitempty"` OAuth2Clients oauth2clientsservice.Config `json:"oauth2Clients" toml:"oauth2_clients,omitempty"` Webhooks webhooksservice.Config `json:"webhooks" toml:"webhooks,omitempty"` AccountInvitations accountinvitationsservice.Config `json:"accountInvitations" toml:"account_invitations,omitempty"` Auth authservice.Config `json:"auth" toml:"auth,omitempty"` // contains filtered or unexported fields }
ServicesConfig collects the various service configurations.
func (*ServicesConfig) ValidateWithContext ¶
func (cfg *ServicesConfig) ValidateWithContext(ctx context.Context) error
ValidateWithContext validates a InstanceConfig struct.