restructure project, add claudemd
This commit is contained in:
17
go/appenv/appenv.go
Normal file
17
go/appenv/appenv.go
Normal file
@@ -0,0 +1,17 @@
|
||||
// Package appenv exposes the deployment environment that is baked into the
|
||||
// binary at compile time. The concrete value of Environment is selected by a
|
||||
// build tag (see env_development.go / env_staging.go / env_production.go), so it
|
||||
// can never be misconfigured or missing at startup. The bundler propagates it
|
||||
// into the JS bundle via the esbuild `__ENV_TYPE__` define.
|
||||
//
|
||||
// This is the framework half of what used to live in each app's
|
||||
// internal/constants: the app keeps its concrete constants (cookie names,
|
||||
// password rules, ...) and reads the environment from here.
|
||||
package appenv
|
||||
|
||||
// The environment type names. Compared against Environment to branch behaviour.
|
||||
const (
|
||||
EnvTypeDevelopment = "development"
|
||||
EnvTypeStaging = "staging"
|
||||
EnvTypeProduction = "production"
|
||||
)
|
||||
8
go/appenv/env_development.go
Normal file
8
go/appenv/env_development.go
Normal file
@@ -0,0 +1,8 @@
|
||||
//go:build !staging && !production
|
||||
|
||||
package appenv
|
||||
|
||||
// Environment is the deployment environment baked in at compile time.
|
||||
// Development is the default; build with `-tags staging` or `-tags production`
|
||||
// to select another environment.
|
||||
const Environment = EnvTypeDevelopment
|
||||
6
go/appenv/env_production.go
Normal file
6
go/appenv/env_production.go
Normal file
@@ -0,0 +1,6 @@
|
||||
//go:build production
|
||||
|
||||
package appenv
|
||||
|
||||
// Selected by `-tags production`. See env_development.go for the full rationale.
|
||||
const Environment = EnvTypeProduction
|
||||
6
go/appenv/env_staging.go
Normal file
6
go/appenv/env_staging.go
Normal file
@@ -0,0 +1,6 @@
|
||||
//go:build staging
|
||||
|
||||
package appenv
|
||||
|
||||
// Selected by `-tags staging`. See env_development.go for the full rationale.
|
||||
const Environment = EnvTypeStaging
|
||||
Reference in New Issue
Block a user