config

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package config provides environment-based configuration for google-group-sync.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Google Workspace settings.
	GoogleAdminEmail string `env:"GOOGLE_ADMIN_EMAIL"`
	GoogleSAKeyJSON  string `env:"GOOGLE_SA_KEY_JSON"`
	GoogleSAKeyFile  string `env:"GOOGLE_SA_KEY_FILE"`

	// Secrets Manager (Lambda: load SA key at startup).
	SAKeySecretName string `env:"SA_KEY_SECRET_NAME"`

	// Server settings.
	Port       int `env:"PORT"`
	HealthPort int `env:"HEALTH_PORT"`

	// Cache settings.
	CacheTTL     time.Duration `env:"CACHE_TTL"`
	CacheMaxSize int           `env:"CACHE_MAX_SIZE"`

	// Logging.
	LogLevel  string `env:"LOG_LEVEL"`
	LogFormat string `env:"LOG_FORMAT"`
}

Config holds all service configuration loaded from environment variables.

func DefaultConfig added in v0.3.0

func DefaultConfig() Config

DefaultConfig returns the standard defaults shared by all entry points.

func ExtensionDefaults added in v0.3.0

func ExtensionDefaults() Config

ExtensionDefaults returns defaults for the Lambda Extension entry point. Port 9090 (avoids conflict with host Lambda), health disabled.

func Load

func Load(defaults *Config, opts Options) (*Config, error)

Load reads configuration from environment variables with the given options. The config starts from the provided defaults, then env vars override.

func (*Config) SAKeyJSON

func (c *Config) SAKeyJSON() ([]byte, error)

SAKeyJSON returns the SA key JSON content, reading from file if necessary.

type Options added in v0.3.0

type Options struct {
	// Prefix for env var names (e.g., "GGS_" reads GGS_PORT instead of PORT).
	Prefix string
}

Options controls how config is loaded. Different entry points pass different options.

Jump to

Keyboard shortcuts

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