config

package
v0.0.0-...-98cd694 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 29, 2024 License: Unlicense Imports: 38 Imported by: 0

Documentation

Overview

Package config provides configuration structs for every service

Index

Constants

View Source
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

View Source
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 CloserFunc

type CloserFunc func()

CloserFunc calls all io.Closers in the service.

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

func (cfg *InstanceConfig) EncodeToFile(path string, marshaller func(v any) ([]byte, error)) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL