Documentation
¶
Overview ¶
Package config defines the shared, user-facing types used inside a project's gothic.config.go file: the typed environment-value builders (Env, SSMParam, SecretsManager) and the GothicContext passed to lifecycle hooks.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AWSProvider ¶ added in v1.1.0
type AWSProvider struct {
ServerMemory int
ServerTimeout int
Region string
Profile string
Stages map[string]Stage
}
AWSProvider holds the AWS-specific deploy settings and per-stage configuration.
type CacheConfig ¶
type CacheConfig struct {
RedisURL string
RedisPassword string
RedisTLS bool
CacheFilesPath string
Compression bool
CompressionMethod CompressionMethod
}
CacheConfig carries backend-specific cache settings.
type CacheType ¶
type CacheType int
CacheType selects a cache backend.
const ( // CACHE_CONTROL_HEADERS is the default — production behavior emitting // Cache-Control headers for a CDN rather than storing responses. CACHE_CONTROL_HEADERS CacheType = iota // IN_MEMORY caches responses in a Go in-memory map. IN_MEMORY // REDIS caches responses in Redis (see CacheConfig.RedisURL). REDIS // LOCAL_FILES caches responses on the local filesystem. LOCAL_FILES )
type CompressionMethod ¶
type CompressionMethod int
CompressionMethod selects a compression algorithm for cached/served payloads.
const ( // GZIP is the default compression method. GZIP CompressionMethod = iota // BROTLI uses Brotli compression. BROTLI )
type Config ¶
type Config struct {
ProjectName string
TofuBinaryPath string
DockerfilePath string
WasmBinary string
TailwindBinary string
OptimizeImages OptimizeImagesConfig
// Runtime is the routing/caching configuration the generated main.go hands to
// gothicServer.Middleware. It is read at runtime (not by the CLI's config
// parser), and its zero value is the default behavior, so it may be omitted.
Runtime RuntimeConfig
Deploy *DeployConfig
}
Config is the user-facing configuration type declared in a project's gothic.config.go file. It mirrors the internal cli.Config that the AST parser produces, but lives here so user projects can reference it via the public gothicframework/core/config package without importing CLI internals.
GoModuleName is intentionally absent: it is read from go.mod at runtime.
type DeployConfig ¶
type DeployConfig struct {
// Provider chooses which cloud to deploy to. Defaults to AWS.
Provider Provider
// Providers holds the per-provider deploy settings.
Providers Providers
}
DeployConfig selects a deploy provider and holds the per-provider settings. The AWS-specific settings (memory, timeout, region, profile, stages) now live under Providers.AWS so additional providers can be added under Providers later without reshaping the top-level Deploy block.
type EnvValue ¶
type EnvValue struct {
Source EnvSource
Value string
// JSONKey, when non-empty, selects a single field out of a JSON-encoded
// secret/parameter at deploy time (jsondecode(...)["JSONKey"]). Set via .Get.
JSONKey string
}
EnvValue is an opaque typed wrapper around a runtime env var. Users construct these via the builder functions below; the AST parser identifies each builder by its call-expression function name.
func SecretsManager ¶
SecretsManager declares an environment value sourced from a Secrets Manager path/ARN.
func (EnvValue) Get ¶
Get selects a single field from a JSON-encoded secret or parameter. AWS Secrets Manager secrets are commonly stored as a JSON object (e.g. {"secret-key":"..."}); gothic.SecretsManager("/myapp/dev/api-key").Get("secret-key") pulls just that key at deploy time via Terraform's jsondecode, so the env var receives the value rather than the whole JSON blob. It also works on JSON-valued SSMParam entries.
type GothicContext ¶
type GothicContext struct {
Stage string
ProjectName string
Suffix string
Region string
Env map[string]EnvValue
Outputs map[string]string
}
GothicContext is injected into BeforeDeploy / AfterDeploy lifecycle hooks.
type OptimizeImagesConfig ¶
type OptimizeImagesConfig struct {
LowResolutionRate int
}
OptimizeImagesConfig controls image optimization defaults.
type Provider ¶ added in v1.1.0
type Provider int
Provider selects which cloud the stack deploys to. v3 ships AWS only; GCP and Azure are reserved for later without changing the config shape.
type Providers ¶ added in v1.1.0
type Providers struct {
AWS AWSProvider
}
Providers groups the per-provider deploy settings. Only AWS exists in v3; future providers (e.g. GCP, Azure) are added here as additional value fields.
type RuntimeConfig ¶
type RuntimeConfig struct {
// CacheStrategy selects the production cache backend.
CacheStrategy CacheType
// LocalDevelopmentCache selects the dev (hot-reload) cache backend.
LocalDevelopmentCache CacheType
// ServeStaticFiles controls when /public/* is served from disk.
ServeStaticFiles StaticFilesMode
// CacheConfig provides backend-specific settings (Redis URL, file path, ...).
CacheConfig *CacheConfig
}
RuntimeConfig is the runtime routing/caching configuration for the server. Its zero value is the sensible default (CACHE_CONTROL_HEADERS in production, in-memory in dev, static files served only under hot reload), so a project may omit the Runtime field entirely.
type Stage ¶
type Stage struct {
HostedZoneId EnvValue
CustomDomain EnvValue
CertificateArn EnvValue
WafArn EnvValue
ENV map[string]EnvValue
}
Stage is the per-stage configuration declared inside Deploy.Providers.AWS.Stages.
HostedZoneId, CustomDomain, CertificateArn and WafArn are source-aware EnvValues (built with gothic.Env / gothic.SSMParam / gothic.SecretsManager) exactly like ENV entries, so a domain or an ARN can be pulled from SSM Parameter Store or Secrets Manager at deploy time instead of being committed in plain text. Use gothic.Env("literal") for a plain value.
type StaticFilesMode ¶
type StaticFilesMode int
StaticFilesMode controls when /public/* assets are served from local disk.
const ( // HOT_RELOAD_ONLY (default) serves /public/* from disk only during development; // in production CloudFront serves them from S3. HOT_RELOAD_ONLY StaticFilesMode = iota // ALL_ENVS serves /public/* from disk in every environment (the public folder // must ship alongside the server binary). ALL_ENVS )