config

package
v1.35.9 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Module

func Module() fx.Option

Types

type API added in v1.29.0

type API struct {
	Host string `yaml:"host" envconfig:"HTTP__API__HOST"` // public API host
	Path string `yaml:"path" envconfig:"HTTP__API__PATH"` // public API path
}

type Cache added in v1.30.0

type Cache struct {
	URL string `yaml:"url" envconfig:"CACHE__URL"`
}

type Config

type Config struct {
	Gateway  Gateway   `yaml:"gateway"`  // gateway config
	HTTP     HTTP      `yaml:"http"`     // http server config
	Database Database  `yaml:"database"` // database config
	FCM      FCMConfig `yaml:"fcm"`      // firebase cloud messaging config
	SSE      SSE       `yaml:"sse"`      // server-sent events config
	Messages Messages  `yaml:"messages"` // messages config
	Cache    Cache     `yaml:"cache"`    // cache (memory or redis) config
	PubSub   PubSub    `yaml:"pubsub"`   // pubsub (memory or redis) config
	JWT      JWT       `yaml:"jwt"`      // jwt config
	OTP      OTP       `yaml:"otp"`      // one-time password config
}

func Default added in v1.34.3

func Default() Config

type Database

type Database struct {
	Host     string `yaml:"host"     envconfig:"DATABASE__HOST"`     // database host
	Port     int    `yaml:"port"     envconfig:"DATABASE__PORT"`     // database port
	User     string `yaml:"user"     envconfig:"DATABASE__USER"`     // database user
	Password string `yaml:"password" envconfig:"DATABASE__PASSWORD"` // database password
	Database string `yaml:"database" envconfig:"DATABASE__DATABASE"` // database name
	Timezone string `yaml:"timezone" envconfig:"DATABASE__TIMEZONE"` // database timezone
	Debug    bool   `yaml:"debug"    envconfig:"DATABASE__DEBUG"`    // debug mode

	MaxOpenConns int `yaml:"max_open_conns" envconfig:"DATABASE__MAX_OPEN_CONNS"` // max open connections
	MaxIdleConns int `yaml:"max_idle_conns" envconfig:"DATABASE__MAX_IDLE_CONNS"` // max idle connections
}

type Duration added in v1.35.0

type Duration time.Duration

func (*Duration) Duration added in v1.35.0

func (d *Duration) Duration() time.Duration

Duration returns the underlying time.Duration value.

func (*Duration) String added in v1.35.0

func (d *Duration) String() string

String returns the string representation of the duration.

func (*Duration) UnmarshalText added in v1.35.0

func (d *Duration) UnmarshalText(text []byte) error

func (*Duration) UnmarshalYAML added in v1.35.0

func (d *Duration) UnmarshalYAML(value *yaml.Node) error

type FCMConfig

type FCMConfig struct {
	CredentialsJSON string `yaml:"credentials_json" envconfig:"FCM__CREDENTIALS_JSON"` // firebase credentials json (public mode only)
	DebounceSeconds uint16 `yaml:"debounce_seconds" envconfig:"FCM__DEBOUNCE_SECONDS"` // push notification debounce (>= 5s)
	TimeoutSeconds  uint16 `yaml:"timeout_seconds"  envconfig:"FCM__TIMEOUT_SECONDS"`  // push notification send timeout
}

type Gateway

type Gateway struct {
	Mode         GatewayMode `yaml:"mode"          envconfig:"GATEWAY__MODE"`          // gateway mode: public or private
	PrivateToken string      `yaml:"private_token" envconfig:"GATEWAY__PRIVATE_TOKEN"` // device registration token in private mode
}

type GatewayMode

type GatewayMode string
const (
	GatewayModePublic  GatewayMode = "public"
	GatewayModePrivate GatewayMode = "private"
)

type HTTP

type HTTP struct {
	Listen  string   `yaml:"listen"  envconfig:"HTTP__LISTEN"`  // listen address
	Proxies []string `yaml:"proxies" envconfig:"HTTP__PROXIES"` // proxies

	API     API     `yaml:"api"`
	OpenAPI OpenAPI `yaml:"openapi"`
}

type HashingTask

type HashingTask struct {
	IntervalSeconds uint16 `yaml:"interval_seconds" envconfig:"TASKS__HASHING__INTERVAL_SECONDS"` // deprecated
}

type JWT added in v1.35.0

type JWT struct {
	Secret string   `yaml:"secret" envconfig:"JWT__SECRET"`
	TTL    Duration `yaml:"ttl"    envconfig:"JWT__TTL"`
	Issuer string   `yaml:"issuer" envconfig:"JWT__ISSUER"`
}

type Messages added in v1.31.0

type Messages struct {
	CacheTTLSeconds        uint16 `yaml:"cache_ttl_seconds"        envconfig:"MESSAGES__CACHE_TTL_SECONDS"`        // cache ttl in seconds
	HashingIntervalSeconds uint16 `yaml:"hashing_interval_seconds" envconfig:"MESSAGES__HASHING_INTERVAL_SECONDS"` // hashing interval in seconds
}

type OTP added in v1.35.1

type OTP struct {
	TTL     uint16 `yaml:"ttl"     envconfig:"OTP__TTL"`
	Retries uint8  `yaml:"retries" envconfig:"OTP__RETRIES"`
}

type OpenAPI added in v1.29.0

type OpenAPI struct {
	Enabled bool `yaml:"enabled" envconfig:"HTTP__OPENAPI__ENABLED"` // openapi enabled
}

type PubSub added in v1.32.0

type PubSub struct {
	URL        string `yaml:"url"         envconfig:"PUBSUB__URL"`
	BufferSize uint   `yaml:"buffer_size" envconfig:"PUBSUB__BUFFER_SIZE"`
}

type SSE added in v1.26.0

type SSE struct {
	KeepAlivePeriodSeconds uint16 `yaml:"keep_alive_period_seconds" envconfig:"SSE__KEEP_ALIVE_PERIOD_SECONDS"` // keep alive period in seconds, 0 for no keep alive
}

Jump to

Keyboard shortcuts

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