Documentation
¶
Index ¶
- Variables
- type ActivityOptions
- func (*ActivityOptions) Descriptor() ([]byte, []int)deprecated
- func (x *ActivityOptions) GetDetail() []string
- func (x *ActivityOptions) GetEnv() string
- func (x *ActivityOptions) GetNone() string
- func (x *ActivityOptions) GetScope() string
- func (x *ActivityOptions) GetTarget() *ActivityTarget
- func (x *ActivityOptions) GetVerb() string
- func (x *ActivityOptions) GetWriter() ActivityWriter
- func (*ActivityOptions) ProtoMessage()
- func (x *ActivityOptions) ProtoReflect() protoreflect.Message
- func (x *ActivityOptions) Reset()
- func (x *ActivityOptions) String() string
- type ActivityTarget
- func (*ActivityTarget) Descriptor() ([]byte, []int)deprecated
- func (x *ActivityTarget) GetId() string
- func (x *ActivityTarget) GetKind() string
- func (x *ActivityTarget) GetLabel() string
- func (*ActivityTarget) ProtoMessage()
- func (x *ActivityTarget) ProtoReflect() protoreflect.Message
- func (x *ActivityTarget) Reset()
- func (x *ActivityTarget) String() string
- type ActivityWriter
- func (ActivityWriter) Descriptor() protoreflect.EnumDescriptor
- func (x ActivityWriter) Enum() *ActivityWriter
- func (ActivityWriter) EnumDescriptor() ([]byte, []int)deprecated
- func (x ActivityWriter) Number() protoreflect.EnumNumber
- func (x ActivityWriter) String() string
- func (ActivityWriter) Type() protoreflect.EnumType
- type AuthConfig
- func (*AuthConfig) Descriptor() ([]byte, []int)deprecated
- func (x *AuthConfig) GetAuthProvider() string
- func (x *AuthConfig) GetAuthRequired() bool
- func (*AuthConfig) ProtoMessage()
- func (x *AuthConfig) ProtoReflect() protoreflect.Message
- func (x *AuthConfig) Reset()
- func (x *AuthConfig) String() string
- type BinaryConfigOptions
- func (*BinaryConfigOptions) Descriptor() ([]byte, []int)deprecated
- func (x *BinaryConfigOptions) GetBinary() string
- func (x *BinaryConfigOptions) GetCommand() []string
- func (x *BinaryConfigOptions) GetSubtrees() []*CommandPath
- func (*BinaryConfigOptions) ProtoMessage()
- func (x *BinaryConfigOptions) ProtoReflect() protoreflect.Message
- func (x *BinaryConfigOptions) Reset()
- func (x *BinaryConfigOptions) String() string
- type CommandPath
- type ConfigCondition
- func (*ConfigCondition) Descriptor() ([]byte, []int)deprecated
- func (x *ConfigCondition) GetEquals() string
- func (x *ConfigCondition) GetField() string
- func (*ConfigCondition) ProtoMessage()
- func (x *ConfigCondition) ProtoReflect() protoreflect.Message
- func (x *ConfigCondition) Reset()
- func (x *ConfigCondition) String() string
- type ConfigFieldOptions
- func (*ConfigFieldOptions) Descriptor() ([]byte, []int)deprecated
- func (x *ConfigFieldOptions) GetAllowedValues() []string
- func (x *ConfigFieldOptions) GetCategory() string
- func (x *ConfigFieldOptions) GetDefaultValue() string
- func (x *ConfigFieldOptions) GetDescription() string
- func (x *ConfigFieldOptions) GetEnvPrefix() string
- func (x *ConfigFieldOptions) GetEnvSuffix() string
- func (x *ConfigFieldOptions) GetEnvVar() string
- func (x *ConfigFieldOptions) GetEnvVarAliases() []*EnvVarAlias
- func (x *ConfigFieldOptions) GetFlag() string
- func (x *ConfigFieldOptions) GetOptional() bool
- func (x *ConfigFieldOptions) GetRequired() bool
- func (x *ConfigFieldOptions) GetRequiredWhen() []*ConfigCondition
- func (x *ConfigFieldOptions) GetRole() ConfigFieldRole
- func (x *ConfigFieldOptions) GetSensitive() bool
- func (*ConfigFieldOptions) ProtoMessage()
- func (x *ConfigFieldOptions) ProtoReflect() protoreflect.Message
- func (x *ConfigFieldOptions) Reset()
- func (x *ConfigFieldOptions) String() string
- type ConfigFieldRole
- func (ConfigFieldRole) Descriptor() protoreflect.EnumDescriptor
- func (x ConfigFieldRole) Enum() *ConfigFieldRole
- func (ConfigFieldRole) EnumDescriptor() ([]byte, []int)deprecated
- func (x ConfigFieldRole) Number() protoreflect.EnumNumber
- func (x ConfigFieldRole) String() string
- func (ConfigFieldRole) Type() protoreflect.EnumType
- type EntityOptions
- func (*EntityOptions) Descriptor() ([]byte, []int)deprecated
- func (x *EntityOptions) GetIndexes() []*IndexDef
- func (x *EntityOptions) GetMiddleware() []string
- func (x *EntityOptions) GetSoftDelete() bool
- func (x *EntityOptions) GetTable() string
- func (x *EntityOptions) GetTimestamps() bool
- func (*EntityOptions) ProtoMessage()
- func (x *EntityOptions) ProtoReflect() protoreflect.Message
- func (x *EntityOptions) Reset()
- func (x *EntityOptions) String() string
- type EnvVarAlias
- func (*EnvVarAlias) Descriptor() ([]byte, []int)deprecated
- func (x *EnvVarAlias) GetDeprecated() bool
- func (x *EnvVarAlias) GetName() string
- func (x *EnvVarAlias) GetValues() map[string]string
- func (*EnvVarAlias) ProtoMessage()
- func (x *EnvVarAlias) ProtoReflect() protoreflect.Message
- func (x *EnvVarAlias) Reset()
- func (x *EnvVarAlias) String() string
- type FieldOptions
- func (*FieldOptions) Descriptor() ([]byte, []int)deprecated
- func (x *FieldOptions) GetDefaultValue() string
- func (x *FieldOptions) GetImmutable() bool
- func (x *FieldOptions) GetIndex() bool
- func (x *FieldOptions) GetPk() bool
- func (x *FieldOptions) GetRef() string
- func (x *FieldOptions) GetSkip() bool
- func (x *FieldOptions) GetStore() StoreAs
- func (x *FieldOptions) GetUnique() bool
- func (x *FieldOptions) GetValidate() *ValidationRules
- func (*FieldOptions) ProtoMessage()
- func (x *FieldOptions) ProtoReflect() protoreflect.Message
- func (x *FieldOptions) Reset()
- func (x *FieldOptions) String() string
- type FrontendConfigOptions
- func (*FrontendConfigOptions) Descriptor() ([]byte, []int)deprecated
- func (x *FrontendConfigOptions) GetFrontend() string
- func (*FrontendConfigOptions) ProtoMessage()
- func (x *FrontendConfigOptions) ProtoReflect() protoreflect.Message
- func (x *FrontendConfigOptions) Reset()
- func (x *FrontendConfigOptions) String() string
- type IndexDef
- func (*IndexDef) Descriptor() ([]byte, []int)deprecated
- func (x *IndexDef) GetFields() []string
- func (x *IndexDef) GetName() string
- func (x *IndexDef) GetUnique() bool
- func (*IndexDef) ProtoMessage()
- func (x *IndexDef) ProtoReflect() protoreflect.Message
- func (x *IndexDef) Reset()
- func (x *IndexDef) String() string
- type MethodOptions
- func (*MethodOptions) Descriptor() ([]byte, []int)deprecated
- func (x *MethodOptions) GetActivity() *ActivityOptions
- func (x *MethodOptions) GetAuthRequired() bool
- func (x *MethodOptions) GetErrors() []string
- func (x *MethodOptions) GetIdempotencyKey() bool
- func (x *MethodOptions) GetIdempotent() bool
- func (x *MethodOptions) GetTimeout() *durationpb.Duration
- func (*MethodOptions) ProtoMessage()
- func (x *MethodOptions) ProtoReflect() protoreflect.Message
- func (x *MethodOptions) Reset()
- func (x *MethodOptions) String() string
- type ServiceOptions
- func (*ServiceOptions) Descriptor() ([]byte, []int)deprecated
- func (x *ServiceOptions) GetAudience() string
- func (x *ServiceOptions) GetAuth() *AuthConfig
- func (x *ServiceOptions) GetDependencies() []string
- func (x *ServiceOptions) GetDescription() string
- func (x *ServiceOptions) GetName() string
- func (x *ServiceOptions) GetVersion() string
- func (x *ServiceOptions) GetVisibility() ServiceVisibility
- func (*ServiceOptions) ProtoMessage()
- func (x *ServiceOptions) ProtoReflect() protoreflect.Message
- func (x *ServiceOptions) Reset()
- func (x *ServiceOptions) String() string
- type ServiceVisibility
- func (ServiceVisibility) Descriptor() protoreflect.EnumDescriptor
- func (x ServiceVisibility) Enum() *ServiceVisibility
- func (ServiceVisibility) EnumDescriptor() ([]byte, []int)deprecated
- func (x ServiceVisibility) Number() protoreflect.EnumNumber
- func (x ServiceVisibility) String() string
- func (ServiceVisibility) Type() protoreflect.EnumType
- type StoreAs
- type ValidationRules
- func (*ValidationRules) Descriptor() ([]byte, []int)deprecated
- func (x *ValidationRules) GetAllowedValues() []string
- func (x *ValidationRules) GetCustom() string
- func (x *ValidationRules) GetFormat() string
- func (x *ValidationRules) GetMax() float64
- func (x *ValidationRules) GetMaxLength() int32
- func (x *ValidationRules) GetMin() float64
- func (x *ValidationRules) GetMinLength() int32
- func (x *ValidationRules) GetPattern() string
- func (x *ValidationRules) GetRequired() bool
- func (*ValidationRules) ProtoMessage()
- func (x *ValidationRules) ProtoReflect() protoreflect.Message
- func (x *ValidationRules) Reset()
- func (x *ValidationRules) String() string
Constants ¶
This section is empty.
Variables ¶
var ( StoreAs_name = map[int32]string{ 0: "STORE_AS_UNSPECIFIED", 1: "STORE_AS_JSONB", 2: "STORE_AS_TEXT", 3: "STORE_AS_BLOB", 4: "STORE_AS_TABLE", } StoreAs_value = map[string]int32{ "STORE_AS_UNSPECIFIED": 0, "STORE_AS_JSONB": 1, "STORE_AS_TEXT": 2, "STORE_AS_BLOB": 3, "STORE_AS_TABLE": 4, } )
Enum value maps for StoreAs.
var ( ServiceVisibility_name = map[int32]string{ 0: "SERVICE_VISIBILITY_UNSPECIFIED", 1: "SERVICE_VISIBILITY_API", 2: "SERVICE_VISIBILITY_INTERNAL", } ServiceVisibility_value = map[string]int32{ "SERVICE_VISIBILITY_UNSPECIFIED": 0, "SERVICE_VISIBILITY_API": 1, "SERVICE_VISIBILITY_INTERNAL": 2, } )
Enum value maps for ServiceVisibility.
var ( ActivityWriter_name = map[int32]string{ 0: "ACTIVITY_WRITER_UNSPECIFIED", 1: "ACTIVITY_WRITER_INTERCEPTOR", 2: "ACTIVITY_WRITER_HANDLER", } ActivityWriter_value = map[string]int32{ "ACTIVITY_WRITER_UNSPECIFIED": 0, "ACTIVITY_WRITER_INTERCEPTOR": 1, "ACTIVITY_WRITER_HANDLER": 2, } )
Enum value maps for ActivityWriter.
var ( ConfigFieldRole_name = map[int32]string{ 0: "CONFIG_FIELD_ROLE_UNSPECIFIED", 1: "CONFIG_FIELD_ROLE_MODE", 2: "CONFIG_FIELD_ROLE_TLS_CERT", 3: "CONFIG_FIELD_ROLE_TLS_KEY", 4: "CONFIG_FIELD_ROLE_CORS_ORIGINS", 5: "CONFIG_FIELD_ROLE_CORS_ALLOW_CREDENTIALS", } ConfigFieldRole_value = map[string]int32{ "CONFIG_FIELD_ROLE_UNSPECIFIED": 0, "CONFIG_FIELD_ROLE_MODE": 1, "CONFIG_FIELD_ROLE_TLS_CERT": 2, "CONFIG_FIELD_ROLE_TLS_KEY": 3, "CONFIG_FIELD_ROLE_CORS_ORIGINS": 4, "CONFIG_FIELD_ROLE_CORS_ALLOW_CREDENTIALS": 5, } )
Enum value maps for ConfigFieldRole.
var ( // optional forge.v1.EntityOptions entity = 50200; E_Entity = &file_forge_v1_forge_proto_extTypes[0] // Binds a config message to the binary that loads it. See BinaryConfigOptions. // // optional forge.v1.BinaryConfigOptions binary_config = 50201; E_BinaryConfig = &file_forge_v1_forge_proto_extTypes[1] // Binds a config message to the frontend that loads it. See // FrontendConfigOptions. // // optional forge.v1.FrontendConfigOptions frontend_config = 50202; E_FrontendConfig = &file_forge_v1_forge_proto_extTypes[2] )
Extension fields to descriptorpb.MessageOptions.
var ( // Database column mapping and constraints. // // Retired: ignored by forge. SQL is the schema — db/migrations drive entity // projections. Kept only so legacy protos keep compiling. // // optional forge.v1.FieldOptions field = 50300; E_Field = &file_forge_v1_forge_proto_extTypes[3] // Configuration binding to environment variables and CLI flags. // // optional forge.v1.ConfigFieldOptions config = 50400; E_Config = &file_forge_v1_forge_proto_extTypes[4] )
Extension fields to descriptorpb.FieldOptions.
var (
// optional forge.v1.MethodOptions method = 50100;
E_Method = &file_forge_v1_forge_proto_extTypes[6]
)
Extension fields to descriptorpb.MethodOptions.
var (
// optional forge.v1.ServiceOptions service = 50000;
E_Service = &file_forge_v1_forge_proto_extTypes[5]
)
Extension fields to descriptorpb.ServiceOptions.
var File_forge_v1_forge_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type ActivityOptions ¶ added in v1.0.0
type ActivityOptions struct {
// Verb is the action, a lower_snake token: "promote", "rotate",
// "restart". It is stored as written; the UI phrases it ("promoted").
Verb string `protobuf:"bytes,1,opt,name=verb,proto3" json:"verb,omitempty"`
// Target names the object the action was done to.
Target *ActivityTarget `protobuf:"bytes,2,opt,name=target,proto3" json:"target,omitempty"`
// Env is the field path whose value is the environment the action
// happened in. Empty records a project-level event.
Env string `protobuf:"bytes,3,opt,name=env,proto3" json:"env,omitempty"`
// Scope is the field path whose value is the scope (an org, a project)
// reads are filtered by. Empty takes the interceptor's
// ScopeFrom default (the caller's org).
Scope string `protobuf:"bytes,4,opt,name=scope,proto3" json:"scope,omitempty"`
// Detail lists field paths copied into the event's detail map, keyed by
// each path's last segment.
Detail []string `protobuf:"bytes,5,rep,name=detail,proto3" json:"detail,omitempty"`
// Writer says who writes the event. The default, the interceptor, writes
// it after the handler succeeds. HANDLER means the handler calls
// activity.Record inside its own transaction, so the event commits or
// rolls back with the mutation.
Writer ActivityWriter `protobuf:"varint,6,opt,name=writer,proto3,enum=forge.v1.ActivityWriter" json:"writer,omitempty"`
// None records that this rpc changes nothing worth an activity event,
// and says why: `activity: { none: "dry run: computes a plan only" }`.
// It excludes every other field, and the reason must not be empty.
None string `protobuf:"bytes,7,opt,name=none,proto3" json:"none,omitempty"`
// contains filtered or unexported fields
}
ActivityOptions declares the activity event an rpc records, or that it records none.
rpc PromoteRelease(PromoteReleaseRequest) returns (PromoteReleaseResponse) {
option (forge.v1.method) = {
activity: {
verb: "promote"
target: { kind: "release", id: "release_id", label: "response.release.version" }
env: "to_env"
}
};
}
FIELD PATHS (target.id, target.label, env, scope, detail) are dotted proto field names resolved against the REQUEST, or against the RESPONSE when they start with "response." — a created object's id exists only in the response. Every path must end on a scalar or an enum field.
A Create<E>, Update<E> or Delete<E> rpc whose messages have forge's CRUD shape needs no option: verb create/update/delete and target kind snake(E) are implied (forge/pkg/activity.Resolve). An explicit option wins.
func (*ActivityOptions) Descriptor
deprecated
added in
v1.0.0
func (*ActivityOptions) Descriptor() ([]byte, []int)
Deprecated: Use ActivityOptions.ProtoReflect.Descriptor instead.
func (*ActivityOptions) GetDetail ¶ added in v1.0.0
func (x *ActivityOptions) GetDetail() []string
func (*ActivityOptions) GetEnv ¶ added in v1.0.0
func (x *ActivityOptions) GetEnv() string
func (*ActivityOptions) GetNone ¶ added in v1.0.0
func (x *ActivityOptions) GetNone() string
func (*ActivityOptions) GetScope ¶ added in v1.0.0
func (x *ActivityOptions) GetScope() string
func (*ActivityOptions) GetTarget ¶ added in v1.0.0
func (x *ActivityOptions) GetTarget() *ActivityTarget
func (*ActivityOptions) GetVerb ¶ added in v1.0.0
func (x *ActivityOptions) GetVerb() string
func (*ActivityOptions) GetWriter ¶ added in v1.0.0
func (x *ActivityOptions) GetWriter() ActivityWriter
func (*ActivityOptions) ProtoMessage ¶ added in v1.0.0
func (*ActivityOptions) ProtoMessage()
func (*ActivityOptions) ProtoReflect ¶ added in v1.0.0
func (x *ActivityOptions) ProtoReflect() protoreflect.Message
func (*ActivityOptions) Reset ¶ added in v1.0.0
func (x *ActivityOptions) Reset()
func (*ActivityOptions) String ¶ added in v1.0.0
func (x *ActivityOptions) String() string
type ActivityTarget ¶ added in v1.0.0
type ActivityTarget struct {
// Kind is the target's type, a lower_snake literal: "release", "secret".
Kind string `protobuf:"bytes,1,opt,name=kind,proto3" json:"kind,omitempty"`
// Id is the field path of the target's id. Required.
Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
// Label is the field path of a human-readable label for the target.
// Empty falls back to the id.
Label string `protobuf:"bytes,3,opt,name=label,proto3" json:"label,omitempty"`
// contains filtered or unexported fields
}
ActivityTarget names the object an activity event is about.
func (*ActivityTarget) Descriptor
deprecated
added in
v1.0.0
func (*ActivityTarget) Descriptor() ([]byte, []int)
Deprecated: Use ActivityTarget.ProtoReflect.Descriptor instead.
func (*ActivityTarget) GetId ¶ added in v1.0.0
func (x *ActivityTarget) GetId() string
func (*ActivityTarget) GetKind ¶ added in v1.0.0
func (x *ActivityTarget) GetKind() string
func (*ActivityTarget) GetLabel ¶ added in v1.0.0
func (x *ActivityTarget) GetLabel() string
func (*ActivityTarget) ProtoMessage ¶ added in v1.0.0
func (*ActivityTarget) ProtoMessage()
func (*ActivityTarget) ProtoReflect ¶ added in v1.0.0
func (x *ActivityTarget) ProtoReflect() protoreflect.Message
func (*ActivityTarget) Reset ¶ added in v1.0.0
func (x *ActivityTarget) Reset()
func (*ActivityTarget) String ¶ added in v1.0.0
func (x *ActivityTarget) String() string
type ActivityWriter ¶ added in v1.0.0
type ActivityWriter int32
ActivityWriter selects who writes a declared activity event.
const ( // ACTIVITY_WRITER_UNSPECIFIED is the interceptor (the default). ActivityWriter_ACTIVITY_WRITER_UNSPECIFIED ActivityWriter = 0 // ACTIVITY_WRITER_INTERCEPTOR: the activity interceptor writes the event // after the handler returns successfully, best-effort. ActivityWriter_ACTIVITY_WRITER_INTERCEPTOR ActivityWriter = 1 // ACTIVITY_WRITER_HANDLER: the handler calls activity.Record, normally // inside its RunTx so the event is transactional with the mutation. If // the handler succeeds without recording, the interceptor writes the // event itself. Streaming rpcs must use this or `none`. ActivityWriter_ACTIVITY_WRITER_HANDLER ActivityWriter = 2 )
func (ActivityWriter) Descriptor ¶ added in v1.0.0
func (ActivityWriter) Descriptor() protoreflect.EnumDescriptor
func (ActivityWriter) Enum ¶ added in v1.0.0
func (x ActivityWriter) Enum() *ActivityWriter
func (ActivityWriter) EnumDescriptor
deprecated
added in
v1.0.0
func (ActivityWriter) EnumDescriptor() ([]byte, []int)
Deprecated: Use ActivityWriter.Descriptor instead.
func (ActivityWriter) Number ¶ added in v1.0.0
func (x ActivityWriter) Number() protoreflect.EnumNumber
func (ActivityWriter) String ¶ added in v1.0.0
func (x ActivityWriter) String() string
func (ActivityWriter) Type ¶ added in v1.0.0
func (ActivityWriter) Type() protoreflect.EnumType
type AuthConfig ¶
type AuthConfig struct {
// Whether authentication is required for this service by default.
AuthRequired bool `protobuf:"varint,1,opt,name=auth_required,json=authRequired,proto3" json:"auth_required,omitempty"`
// Authentication provider identifier (e.g., "jwt", "api_key", "oauth2").
AuthProvider string `protobuf:"bytes,2,opt,name=auth_provider,json=authProvider,proto3" json:"auth_provider,omitempty"`
// contains filtered or unexported fields
}
AuthConfig defines service-wide authentication defaults. Individual methods can override via MethodOptions.auth_required.
func (*AuthConfig) Descriptor
deprecated
func (*AuthConfig) Descriptor() ([]byte, []int)
Deprecated: Use AuthConfig.ProtoReflect.Descriptor instead.
func (*AuthConfig) GetAuthProvider ¶
func (x *AuthConfig) GetAuthProvider() string
func (*AuthConfig) GetAuthRequired ¶
func (x *AuthConfig) GetAuthRequired() bool
func (*AuthConfig) ProtoMessage ¶
func (*AuthConfig) ProtoMessage()
func (*AuthConfig) ProtoReflect ¶
func (x *AuthConfig) ProtoReflect() protoreflect.Message
func (*AuthConfig) Reset ¶
func (x *AuthConfig) Reset()
func (*AuthConfig) String ¶
func (x *AuthConfig) String() string
type BinaryConfigOptions ¶
type BinaryConfigOptions struct {
// Binary is the cmd/<name> leaf whose process loads this config — the same
// name `forge scaffold binary` creates and the deploy layer names its
// workload after. A message annotated with a binary that has no cmd/<name>
// directory is a generate-time error, not a silently unused config.
Binary string `protobuf:"bytes,1,opt,name=binary,proto3" json:"binary,omitempty"`
// Command is the cobra command path BELOW the binary whose process loads
// this config, one command name per element: ["server", "api"] for
// `reliant server api`. Empty binds the binary's root config. Two
// messages may not bind the same (binary, command).
//
// forge validates the SHAPE at generate time (each element one command
// name: non-empty, no whitespace, not a flag) but cannot prove the path
// exists there: a cobra tree is assembled at runtime by AddCommand calls in
// any package, from `Use` strings that may be computed, so a static scan
// would be a guess that is wrong in both directions — and a wrong refusal
// blocks generate. The exact check runs where the tree is real: the
// generated Load<Msg>(cmd) refuses a command whose path is not this one.
Command []string `protobuf:"bytes,2,rep,name=command,proto3" json:"command,omitempty"`
// Subtrees binds this config to every command AT OR BELOW each path:
// [{path: ["daemon"]}] is loaded by `daemon start`, `daemon status` and
// every other command under `daemon`, and by `daemon` itself. Exclusive
// with `command` (a config is one process's, or a subtree's); both empty
// binds the binary's root config. Each path is shaped like `command`, and
// no path may lie below another of the same message (the outer one already
// covers it). Register<Msg>Flags is called on each path's command; the
// generated Load<Msg>(cmd) refuses a command under none of them.
Subtrees []*CommandPath `protobuf:"bytes,3,rep,name=subtrees,proto3" json:"subtrees,omitempty"`
// contains filtered or unexported fields
}
BinaryConfigOptions binds a config message to the BINARY that loads it, giving each binary its own config surface instead of one project-global AppConfig every process ships.
The problem it solves is ownership, not size: with one shared message, every binary links every field — including credentials it has no business reading — and removing a field for one binary removes it for all of them. Annotating a message with a binary makes that message THAT binary's config: forge generates a loader, a KCL schema and an env projection per binary, so a workload's Deployment carries only ITS binary's env vars and deleting a field from one binary's config cannot affect another's.
Ownership is disjoint; DEFINITIONS may still be shared. Every binary wanting a log level is not duplication — they are separate values on separate processes. Compose a shared message (conventionally BaseConfig) as a field on each binary's config and its leaves are registered once per binary, resolved independently at runtime.
This is an ANNOTATION rather than a naming convention for the same reason ConfigFieldRole is: behavior follows the annotation, never the identifier. Renaming AdminConfig does not re-point it at another binary, and naming a message GatewayConfig does not silently make it the gateway's config.
A project that annotates NOTHING is unchanged: its single AppConfig stays the one config every binary loads. Per-binary config is opt-in.
ONE BINARY, SEVERAL PROCESSES. A binary whose subcommands are different processes (`reliant server api`, `reliant server worker`, `reliant daemon`) scopes a config to a subcommand with `command`, so each process carries only what it reads — the api's credentials never reach the worker's Deployment. The binding is keyed on (binary, command):
The ROOT config (no `command`) is the binary-wide surface: every process of the binary loads it, and its flags register as PERSISTENT flags on the binary's root command, so every subcommand inherits them.
A COMMAND config is loaded by exactly the process running that subcommand. Its leaves — composed blocks included — register as LOCAL flags on that subcommand, and its loader refuses to load from any other command.
A SUBTREE config (`subtrees`) is loaded by every process running a command AT OR BELOW one of its paths. Its leaves register as PERSISTENT flags on each path's command, so the commands beneath inherit them. It is how a setting that several commands read — but not every process of the binary — is declared once: the CLI connection every end-user command needs (server URL, token) without the server roles' workloads carrying it, or the guard policy `daemon start` and `open` both run.
A process therefore reads the root config, every subtree config whose path prefixes its command path, and the ONE config declared for its exact path — and nothing else: least knowledge, by declaration. Two configs one process can load together (the root and anything; a subtree config and a command config or another subtree config below or above it) may not declare the same env var, flag or top-level field: that process would read one value from two declarations that can drift. Configs no process loads together (sibling commands) may compose the same block freely: that is one definition, two values.
message CLIConfig {
option (forge.v1.binary_config) = {
binary: "reliant"
subtrees: [{path: ["auth"]}, {path: ["daemon"]}, {path: ["open"]}]
};
string server_url = 1 [(forge.v1.config) = {env_var: "RELIANT_SERVER_URL", flag: "server"}];
}
func (*BinaryConfigOptions) Descriptor
deprecated
func (*BinaryConfigOptions) Descriptor() ([]byte, []int)
Deprecated: Use BinaryConfigOptions.ProtoReflect.Descriptor instead.
func (*BinaryConfigOptions) GetBinary ¶
func (x *BinaryConfigOptions) GetBinary() string
func (*BinaryConfigOptions) GetCommand ¶
func (x *BinaryConfigOptions) GetCommand() []string
func (*BinaryConfigOptions) GetSubtrees ¶ added in v1.0.0
func (x *BinaryConfigOptions) GetSubtrees() []*CommandPath
func (*BinaryConfigOptions) ProtoMessage ¶
func (*BinaryConfigOptions) ProtoMessage()
func (*BinaryConfigOptions) ProtoReflect ¶
func (x *BinaryConfigOptions) ProtoReflect() protoreflect.Message
func (*BinaryConfigOptions) Reset ¶
func (x *BinaryConfigOptions) Reset()
func (*BinaryConfigOptions) String ¶
func (x *BinaryConfigOptions) String() string
type CommandPath ¶ added in v1.0.0
type CommandPath struct {
Path []string `protobuf:"bytes,1,rep,name=path,proto3" json:"path,omitempty"`
// contains filtered or unexported fields
}
CommandPath is one cobra command path below a binary's root, one command name per element: ["daemon", "start"]. See BinaryConfigOptions.subtrees.
func (*CommandPath) Descriptor
deprecated
added in
v1.0.0
func (*CommandPath) Descriptor() ([]byte, []int)
Deprecated: Use CommandPath.ProtoReflect.Descriptor instead.
func (*CommandPath) GetPath ¶ added in v1.0.0
func (x *CommandPath) GetPath() []string
func (*CommandPath) ProtoMessage ¶ added in v1.0.0
func (*CommandPath) ProtoMessage()
func (*CommandPath) ProtoReflect ¶ added in v1.0.0
func (x *CommandPath) ProtoReflect() protoreflect.Message
func (*CommandPath) Reset ¶ added in v1.0.0
func (x *CommandPath) Reset()
func (*CommandPath) String ¶ added in v1.0.0
func (x *CommandPath) String() string
type ConfigCondition ¶ added in v1.0.0
type ConfigCondition struct {
// Field is the PROTO name of a sibling string field ("hosting"), not its
// env_var: the condition is part of the message, and a rename of the
// field's env spelling must not silently detach it.
Field string `protobuf:"bytes,1,opt,name=field,proto3" json:"field,omitempty"`
// Equals is the value that field must hold for the condition to be true.
// When the field declares allowed_values it must be one of them.
Equals string `protobuf:"bytes,2,opt,name=equals,proto3" json:"equals,omitempty"`
// contains filtered or unexported fields
}
ConfigCondition is a predicate over another field of the same config message, by its runtime value (see ConfigFieldOptions.required_when).
func (*ConfigCondition) Descriptor
deprecated
added in
v1.0.0
func (*ConfigCondition) Descriptor() ([]byte, []int)
Deprecated: Use ConfigCondition.ProtoReflect.Descriptor instead.
func (*ConfigCondition) GetEquals ¶ added in v1.0.0
func (x *ConfigCondition) GetEquals() string
func (*ConfigCondition) GetField ¶ added in v1.0.0
func (x *ConfigCondition) GetField() string
func (*ConfigCondition) ProtoMessage ¶ added in v1.0.0
func (*ConfigCondition) ProtoMessage()
func (*ConfigCondition) ProtoReflect ¶ added in v1.0.0
func (x *ConfigCondition) ProtoReflect() protoreflect.Message
func (*ConfigCondition) Reset ¶ added in v1.0.0
func (x *ConfigCondition) Reset()
func (*ConfigCondition) String ¶ added in v1.0.0
func (x *ConfigCondition) String() string
type ConfigFieldOptions ¶
type ConfigFieldOptions struct {
// Environment variable name to read this field from (e.g., "DATABASE_URL").
// A variable set to "" counts as unset, whatever the field's type: the file
// or default value stands. An explicitly empty value is a flag's to set.
EnvVar string `protobuf:"bytes,1,opt,name=env_var,json=envVar,proto3" json:"env_var,omitempty"`
// CLI flag name, without leading dashes (e.g., "database-url").
Flag string `protobuf:"bytes,2,opt,name=flag,proto3" json:"flag,omitempty"`
// Default value as a string: what the SOURCE says. A build can override
// it — the generated pkg/config.BuildDefaults, stamped with -ldflags -X in
// URL query form keyed by env_var ("SERVER_URL=https://api®ION=eu") —
// and the config file, env var and flag override both:
// default_value < build default < config file < env var < flag.
// A sensitive field takes neither (a secret in a binary is published).
DefaultValue string `protobuf:"bytes,3,opt,name=default_value,json=defaultValue,proto3" json:"default_value,omitempty"`
// Whether this field must be provided. Loading fails if no layer (default,
// config file, env var, flag) gives it a value. It is the ONE runtime
// presence check, for every field kind: `sensitive` does not imply it (see
// `optional` for why). A credential the process cannot run without says
// `required: true` alongside `sensitive: true`.
Required bool `protobuf:"varint,4,opt,name=required,proto3" json:"required,omitempty"`
// Human-readable description shown in --help output and documentation.
Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"`
// Sensitive marks this field as secret — its value MUST come from a
// Kubernetes Secret (or equivalent) rather than a literal env-var, and
// it is never written to forge.yaml inline. The deploy generator emits
// a `secretKeyRef`-shaped EnvVar referencing a project-level Secret
// (default name: <project>-secrets, key: <env_var>), projected into a
// workload's env only when that workload names it in `config_secrets`.
// Sensitive says where a value comes from (a Secret, never a flag or an
// inline manifest value), not whether there must be one: that is
// `required`, at runtime, and the secret pre-flight for a ref a workload
// declares (see `optional`).
Sensitive bool `protobuf:"varint,6,opt,name=sensitive,proto3" json:"sensitive,omitempty"`
// Category groups related fields for KCL emission. Fields with the same
// category are rendered together as a single env-var group (e.g.
// category: "stripe" → STRIPE_ENV bundle). Empty category lands the
// field in the default APP_ENV bundle.
Category string `protobuf:"bytes,7,opt,name=category,proto3" json:"category,omitempty"`
// Role tags a field with a SEMANTIC meaning that drives behavior, so
// forge/pkg/config can offer annotation-driven helpers without matching
// on the field's NAME. Renaming a field never changes behavior — the
// behavior follows the annotation. Naming a field "environment" without
// the annotation does NOT make it the mode field.
Role ConfigFieldRole `protobuf:"varint,8,opt,name=role,proto3,enum=forge.v1.ConfigFieldRole" json:"role,omitempty"`
// AllowedValues constrains a STRING field to a closed set of valid
// values, enforced when the config loads (Load runs config.Validate, so
// an out-of-set value fails the load, naming the field). It is the
// type/annotation-driven replacement for the old name-matched log-format
// check ("json"/"text"): a string field carrying allowed_values is a
// string ENUM, rejected when its resolved value is outside the set. The
// empty value is always permitted (an unset, non-required field). True
// proto enum fields don't need this — protoreflect already enforces their
// domain. Renaming the field changes nothing; the set follows the
// annotation.
AllowedValues []string `protobuf:"bytes,9,rep,name=allowed_values,json=allowedValues,proto3" json:"allowed_values,omitempty"`
// Optional marks a field the application TOLERATES being unset. It acts
// at DEPLOY time; at runtime presence is `required`'s alone.
//
// - sensitive: a secret_ref a workload declares (by naming the field in
// its `config_secrets`) is validated against the env's store before
// anything starts (secrets.ValidateDeclaredRefs), and a declared ref
// with no value is an error by default: discovering a missing
// production credential at runtime is the failure the pre-flight
// exists to prevent. `optional: true` exempts the field from that
// check and marks the rendered ref optional (secretKeyRef.optional /
// managedSecret.optional), so the pod starts without it.
// - not sensitive: the env projection omits the field while its value is
// the schema default, so a knob only some environments set does not
// churn every other environment's manifests.
//
// WHY sensitive DOES NOT IMPLY REQUIRED AT RUNTIME. Whether a credential
// must exist is a property of the WORKLOAD that reads it, not of the
// field: one config is loaded by several workloads, and each projects only
// the secrets its `config_secrets` names. A runtime check implied by
// `sensitive` would refuse to start every workload that deliberately does
// not read one (a worker sharing the API server's config, a key source the
// process uses only when another is unset), forcing a fake value into the
// store. So the deploy pre-flight checks what a workload declares, and a
// field the PROCESS cannot run without says so with `required: true`, the
// same way any other field does.
//
// But an OPTIONAL-BY-DESIGN credential is a real thing, and forge had no
// way to say so. The case that forced this: a config block whose
// admin_user + admin_password are documented as the tier's ON SWITCH —
// with either unset the reconciler is deliberately not registered. Every
// non-sensitive field in that block projects as `str = ""` and unset is
// fine; only the sensitive one became a hard startup requirement, so an
// environment that had deliberately not enabled the tier could not start
// at all. The operator's only recourse was to invent a fake value, which
// puts a real-looking credential in the store and defeats the check for
// everyone.
//
// So: `optional: true` says the absence is intended, and the secret-store
// validation skips the field. It is deliberately an OPT-IN — the safe
// default stays "a declared secret must have a value", and an author has
// to state the exception.
//
// It is an ERROR to set both `required: true` and `optional: true`; they
// are direct contradictions and forge rejects the pair rather than
// silently picking one.
Optional bool `protobuf:"varint,10,opt,name=optional,proto3" json:"optional,omitempty"`
// EnvVarAliases are further environment variables the field is read from,
// in order, when env_var is unset: the first one set wins, and a variable
// set to "" counts as unset, exactly as for env_var. A flag still beats
// all of them.
//
// string environment = 1 [(forge.v1.config) = {
// env_var: "RELIANT_ENV"
// env_var_aliases: [{name: "NODE_ENV"}]
// }];
// int32 port = 2 [(forge.v1.config) = {
// env_var: "DAEMON_LISTEN_PORT"
// env_var_aliases: [{name: "TOOLS_DAEMON_PORT", deprecated: true}]
// }];
//
// An alias is for a SETTER forge does not control: a convention another
// tool owns (NODE_ENV), or an older name a deployment elsewhere still
// exports. forge's own setters use env_var alone — the KCL env map and the
// secret store key name only the primary — so every manifest forge renders
// converges on one name. A flag's --help lists env_var and the permanent
// aliases; a deprecated alias is never advertised.
//
// Aliases need env_var, are read only from the environment, and must not
// repeat any env var or alias another field of the same process reads;
// `forge generate` refuses each of those. A frontend config field takes
// no aliases: its values come from the rendered config document, not
// from an environment.
EnvVarAliases []*EnvVarAlias `protobuf:"bytes,11,rep,name=env_var_aliases,json=envVarAliases,proto3" json:"env_var_aliases,omitempty"`
// EnvPrefix (with EnvSuffix) binds a `map<string, V>` field, V a scalar,
// to a FAMILY of environment variables: every variable named
// <env_prefix><KEY><env_suffix> with a non-empty KEY is one entry,
// map[KEY] = value parsed as V. KEY is taken verbatim.
//
// map<string, string> oauth_client_ids = 1 [(forge.v1.config) = {
// env_prefix: "APP_OAUTH_", env_suffix: "_CLIENT_ID"
// }];
// map<string, string> oauth_client_secrets = 2 [(forge.v1.config) = {
// env_prefix: "APP_OAUTH_", env_suffix: "_CLIENT_SECRET", sensitive: true
// }];
// map<string, bool> features = 3 [(forge.v1.config) = {env_prefix: "APP_FEATURE_"}];
//
// APP_OAUTH_GITHUB_CLIENT_ID=abc loads oauth_client_ids["GITHUB"] = "abc".
// It is for a set of keys the PROCESS does not know at build time (an
// integration catalog, feature names an operator invents); a set the proto
// can name is fields.
//
// The prefix is OWNED: a variable that starts with a family's env_prefix
// and matches no family and no env_var of the process fails the load,
// naming it — APP_OAUTH_GITHUB_CLIENT_SECERT is a typo, never an entry
// silently missing. Env entries overlay the config file's map key by key.
// `required: true` means at least one entry; allowed_values constrains
// every value; `sensitive` keeps the values off flags and inline manifests.
// A family takes no env_var, env_var_aliases, flag or default_value, and
// `forge generate` refuses two families (or a family and an env_var) of one
// process that could claim the same variable.
//
// Families are read from the environment and the config file. The KCL
// config schema projects one as a map keyed by KEY — `{str: str}`, or
// `{str: ConfigSecretRef}` for a sensitive one — and the env projection
// expands each entry to its variable: inline for a plain family, one
// forge.SecretRef per KEY for a sensitive one, which a workload selects
// by naming the family's pattern (APP_OAUTH_<KEY>_CLIENT_SECRET) in
// `config_secrets`.
EnvPrefix string `protobuf:"bytes,12,opt,name=env_prefix,json=envPrefix,proto3" json:"env_prefix,omitempty"`
// EnvSuffix is the fixed tail of an env_prefix family's variable names
// ("_CLIENT_ID"); empty when the KEY runs to the end of the name.
EnvSuffix string `protobuf:"bytes,13,opt,name=env_suffix,json=envSuffix,proto3" json:"env_suffix,omitempty"`
// RequiredWhen makes the field required in a MODE of the config: when any
// listed condition holds, the runtime config document must carry a
// non-empty value for this field. The field's default does not satisfy
// it — the condition names a mode the default is wrong for (a managed
// deployment, where the default is a self-hosted value), or the field
// would not need the condition.
//
// string hosting = 6 [(forge.v1.config) = {
// env_var: "HOSTING", allowed_values: ["cloud"]
// }];
// string api_url = 1 [(forge.v1.config) = {
// env_var: "API_URL"
// required_when: [{field: "hosting", equals: "cloud"}]
// }];
//
// It is for a (forge.v1.frontend_config) message, whose values arrive in
// one document (config.js) that every check can see whole:
// - the generated config_gen.ts refuses the document at boot
// (loadConfig, and missingRequiredConfig for an app that renders its
// own message), naming each missing key and the condition;
// - config_schema_gen.json records it, so a project declaring the
// frontend's environments from ANOTHER repository refuses a
// runtime_config without the key at render, instead of shipping an
// app that boots in the wrong mode;
// - the frontend's typed KCL schema checks it for an in-tree frontend.
// `forge generate` refuses it on a binary config (the loader there layers
// defaults, files, env and flags, and has no single document to judge),
// with `required: true` (redundant), and with a condition naming a field
// that is not a sibling string field or a value outside its
// allowed_values.
RequiredWhen []*ConfigCondition `protobuf:"bytes,14,rep,name=required_when,json=requiredWhen,proto3" json:"required_when,omitempty"`
// contains filtered or unexported fields
}
ConfigFieldOptions defines how a config protobuf field maps to runtime configuration sources (environment variables and CLI flags).
Example usage:
message MyServiceConfig {
string database_url = 1 [(forge.v1.config) = {
env_var: "DATABASE_URL",
flag: "database-url",
required: true,
description: "PostgreSQL connection string"
}];
}
func (*ConfigFieldOptions) Descriptor
deprecated
func (*ConfigFieldOptions) Descriptor() ([]byte, []int)
Deprecated: Use ConfigFieldOptions.ProtoReflect.Descriptor instead.
func (*ConfigFieldOptions) GetAllowedValues ¶
func (x *ConfigFieldOptions) GetAllowedValues() []string
func (*ConfigFieldOptions) GetCategory ¶
func (x *ConfigFieldOptions) GetCategory() string
func (*ConfigFieldOptions) GetDefaultValue ¶
func (x *ConfigFieldOptions) GetDefaultValue() string
func (*ConfigFieldOptions) GetDescription ¶
func (x *ConfigFieldOptions) GetDescription() string
func (*ConfigFieldOptions) GetEnvPrefix ¶ added in v1.0.0
func (x *ConfigFieldOptions) GetEnvPrefix() string
func (*ConfigFieldOptions) GetEnvSuffix ¶ added in v1.0.0
func (x *ConfigFieldOptions) GetEnvSuffix() string
func (*ConfigFieldOptions) GetEnvVar ¶
func (x *ConfigFieldOptions) GetEnvVar() string
func (*ConfigFieldOptions) GetEnvVarAliases ¶
func (x *ConfigFieldOptions) GetEnvVarAliases() []*EnvVarAlias
func (*ConfigFieldOptions) GetFlag ¶
func (x *ConfigFieldOptions) GetFlag() string
func (*ConfigFieldOptions) GetOptional ¶
func (x *ConfigFieldOptions) GetOptional() bool
func (*ConfigFieldOptions) GetRequired ¶
func (x *ConfigFieldOptions) GetRequired() bool
func (*ConfigFieldOptions) GetRequiredWhen ¶ added in v1.0.0
func (x *ConfigFieldOptions) GetRequiredWhen() []*ConfigCondition
func (*ConfigFieldOptions) GetRole ¶
func (x *ConfigFieldOptions) GetRole() ConfigFieldRole
func (*ConfigFieldOptions) GetSensitive ¶
func (x *ConfigFieldOptions) GetSensitive() bool
func (*ConfigFieldOptions) ProtoMessage ¶
func (*ConfigFieldOptions) ProtoMessage()
func (*ConfigFieldOptions) ProtoReflect ¶
func (x *ConfigFieldOptions) ProtoReflect() protoreflect.Message
func (*ConfigFieldOptions) Reset ¶
func (x *ConfigFieldOptions) Reset()
func (*ConfigFieldOptions) String ¶
func (x *ConfigFieldOptions) String() string
type ConfigFieldRole ¶
type ConfigFieldRole int32
ConfigFieldRole enumerates the semantic roles a config field can carry. Today the only role is MODE (the runtime production/development switch that gates dev ergonomics and the explicit auth bypass). Additional roles can be added here as new annotation-driven semantics appear.
const ( // CONFIG_FIELD_ROLE_UNSPECIFIED is the default: an ordinary config // field with no special semantics. ConfigFieldRole_CONFIG_FIELD_ROLE_UNSPECIFIED ConfigFieldRole = 0 // CONFIG_FIELD_ROLE_MODE marks the field whose string value selects the // runtime mode: "development"/"dev" → development, anything else → // production. config.Mode(msg) keys off THIS field, regardless of its // name. ConfigFieldRole_CONFIG_FIELD_ROLE_MODE ConfigFieldRole = 1 // CONFIG_FIELD_ROLE_TLS_CERT and CONFIG_FIELD_ROLE_TLS_KEY mark the two // halves of a TLS keypair. config.Validate enforces both-or-neither: // setting exactly one is a configuration error (the server would silently // fall back to plaintext). Selected by annotation, not by the names // "tls_cert_path"/"tls_key_path". ConfigFieldRole_CONFIG_FIELD_ROLE_TLS_CERT ConfigFieldRole = 2 ConfigFieldRole_CONFIG_FIELD_ROLE_TLS_KEY ConfigFieldRole = 3 // CONFIG_FIELD_ROLE_CORS_ORIGINS marks the comma-separated CORS allow-list // and CONFIG_FIELD_ROLE_CORS_ALLOW_CREDENTIALS marks the credentials bool. // config.Validate rejects the spec-invalid combination of a wildcard // origin ("*") with credentials=true. Selected by annotation, not by the // field names. ConfigFieldRole_CONFIG_FIELD_ROLE_CORS_ORIGINS ConfigFieldRole = 4 ConfigFieldRole_CONFIG_FIELD_ROLE_CORS_ALLOW_CREDENTIALS ConfigFieldRole = 5 )
func (ConfigFieldRole) Descriptor ¶
func (ConfigFieldRole) Descriptor() protoreflect.EnumDescriptor
func (ConfigFieldRole) Enum ¶
func (x ConfigFieldRole) Enum() *ConfigFieldRole
func (ConfigFieldRole) EnumDescriptor
deprecated
func (ConfigFieldRole) EnumDescriptor() ([]byte, []int)
Deprecated: Use ConfigFieldRole.Descriptor instead.
func (ConfigFieldRole) Number ¶
func (x ConfigFieldRole) Number() protoreflect.EnumNumber
func (ConfigFieldRole) String ¶
func (x ConfigFieldRole) String() string
func (ConfigFieldRole) Type ¶
func (ConfigFieldRole) Type() protoreflect.EnumType
type EntityOptions ¶
type EntityOptions struct {
// Database table name. Inferred from the message name (snake_case, pluralized)
// when left empty.
Table string `protobuf:"bytes,1,opt,name=table,proto3" json:"table,omitempty"`
// Enable soft-delete semantics (adds a deleted_at column).
SoftDelete bool `protobuf:"varint,2,opt,name=soft_delete,json=softDelete,proto3" json:"soft_delete,omitempty"`
// Automatically manage created_at and updated_at timestamp columns.
Timestamps bool `protobuf:"varint,3,opt,name=timestamps,proto3" json:"timestamps,omitempty"`
// Composite or single-column indexes to create on this table.
Indexes []*IndexDef `protobuf:"bytes,4,rep,name=indexes,proto3" json:"indexes,omitempty"`
// Contract middleware to wire around generated repository methods.
// Supported values: "tracing", "metrics", "logging".
Middleware []string `protobuf:"bytes,5,rep,name=middleware,proto3" json:"middleware,omitempty"`
// contains filtered or unexported fields
}
EntityOptions defines how a protobuf message maps to a database table.
DEPRECATED — Retired: ignored by forge. SQL is the schema — db/migrations drive entity projections. Kept for one release so legacy projects' protos keep compiling; remove the annotations from your protos.
func (*EntityOptions) Descriptor
deprecated
func (*EntityOptions) Descriptor() ([]byte, []int)
Deprecated: Use EntityOptions.ProtoReflect.Descriptor instead.
func (*EntityOptions) GetIndexes ¶
func (x *EntityOptions) GetIndexes() []*IndexDef
func (*EntityOptions) GetMiddleware ¶
func (x *EntityOptions) GetMiddleware() []string
func (*EntityOptions) GetSoftDelete ¶
func (x *EntityOptions) GetSoftDelete() bool
func (*EntityOptions) GetTable ¶
func (x *EntityOptions) GetTable() string
func (*EntityOptions) GetTimestamps ¶
func (x *EntityOptions) GetTimestamps() bool
func (*EntityOptions) ProtoMessage ¶
func (*EntityOptions) ProtoMessage()
func (*EntityOptions) ProtoReflect ¶
func (x *EntityOptions) ProtoReflect() protoreflect.Message
func (*EntityOptions) Reset ¶
func (x *EntityOptions) Reset()
func (*EntityOptions) String ¶
func (x *EntityOptions) String() string
type EnvVarAlias ¶
type EnvVarAlias struct {
// Name is the environment variable, e.g. "NODE_ENV".
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
// Deprecated marks a name kept only so existing setters keep working
// while they move to env_var. A process that finds it set prints one
// line to stderr at load naming env_var, whether the alias supplied the
// value or was shadowed by an earlier name. A permanent alias (the
// default) is read silently: NODE_ENV is somebody else's convention, not
// a migration in flight, and a notice at every start would be noise.
Deprecated bool `protobuf:"varint,2,opt,name=deprecated,proto3" json:"deprecated,omitempty"`
// Values maps the alias's values onto the FIELD's: the alias is read only
// when it is set to one of the keys, and the field takes the mapped value.
// Any other value — and unset, and "" — reads as the alias being unset, so
// the next name is tried.
//
// string level = 1 [(forge.v1.config) = {
// env_var: "APP_LOG_LEVEL"
// env_var_aliases: [{name: "DEBUG", values: [{key: "true", value: "debug"}, {key: "1", value: "debug"}]}]
// }];
//
// It is for a variable whose CONVENTION implies one of this field's values
// without carrying it: DEBUG=true meaning a debug log level, CI=true a
// non-interactive mode. Such a variable is not this field's to parse —
// DEBUG=express:* belongs to another tool — so a value outside the map is
// ignored rather than refused, which is the one place the config loader
// ignores a value it was handed. Keys match exactly (no trimming, no case
// folding: the convention decides its spelling). Each mapped value must be
// valid for the field (its kind and allowed_values); `forge generate`
// refuses one that is not. A variable your own project owns needs no map:
// name its values after the field's and make it env_var or a plain alias.
Values map[string]string `` /* 139-byte string literal not displayed */
// contains filtered or unexported fields
}
EnvVarAlias is one fallback environment variable of a config field. See ConfigFieldOptions.env_var_aliases.
func (*EnvVarAlias) Descriptor
deprecated
func (*EnvVarAlias) Descriptor() ([]byte, []int)
Deprecated: Use EnvVarAlias.ProtoReflect.Descriptor instead.
func (*EnvVarAlias) GetDeprecated ¶
func (x *EnvVarAlias) GetDeprecated() bool
func (*EnvVarAlias) GetName ¶
func (x *EnvVarAlias) GetName() string
func (*EnvVarAlias) GetValues ¶ added in v1.0.0
func (x *EnvVarAlias) GetValues() map[string]string
func (*EnvVarAlias) ProtoMessage ¶
func (*EnvVarAlias) ProtoMessage()
func (*EnvVarAlias) ProtoReflect ¶
func (x *EnvVarAlias) ProtoReflect() protoreflect.Message
func (*EnvVarAlias) Reset ¶
func (x *EnvVarAlias) Reset()
func (*EnvVarAlias) String ¶
func (x *EnvVarAlias) String() string
type FieldOptions ¶
type FieldOptions struct {
// Mark this field as the primary key.
Pk bool `protobuf:"varint,1,opt,name=pk,proto3" json:"pk,omitempty"`
// How to store complex or non-scalar types in the database.
Store StoreAs `protobuf:"varint,3,opt,name=store,proto3,enum=forge.v1.StoreAs" json:"store,omitempty"`
// Foreign key reference in "table.column" format (e.g., "users.id").
Ref string `protobuf:"bytes,4,opt,name=ref,proto3" json:"ref,omitempty"`
// Column has a UNIQUE constraint.
Unique bool `protobuf:"varint,5,opt,name=unique,proto3" json:"unique,omitempty"`
// Create a single-column index on this field.
Index bool `protobuf:"varint,6,opt,name=index,proto3" json:"index,omitempty"`
// SQL default expression (e.g., "0", "'active'", "NOW()").
DefaultValue string `protobuf:"bytes,7,opt,name=default_value,json=defaultValue,proto3" json:"default_value,omitempty"`
// Skip this field in code generation entirely.
Skip bool `protobuf:"varint,8,opt,name=skip,proto3" json:"skip,omitempty"`
// Application-layer validation rules for this field.
Validate *ValidationRules `protobuf:"bytes,9,opt,name=validate,proto3" json:"validate,omitempty"`
// Field cannot be updated after initial creation.
Immutable bool `protobuf:"varint,10,opt,name=immutable,proto3" json:"immutable,omitempty"`
// contains filtered or unexported fields
}
FieldOptions defines how a protobuf field maps to a database column.
DEPRECATED — Retired: ignored by forge. SQL is the schema — db/migrations drive entity projections. Kept for one release so legacy projects' protos keep compiling; remove the annotations from your protos.
func (*FieldOptions) Descriptor
deprecated
func (*FieldOptions) Descriptor() ([]byte, []int)
Deprecated: Use FieldOptions.ProtoReflect.Descriptor instead.
func (*FieldOptions) GetDefaultValue ¶
func (x *FieldOptions) GetDefaultValue() string
func (*FieldOptions) GetImmutable ¶
func (x *FieldOptions) GetImmutable() bool
func (*FieldOptions) GetIndex ¶
func (x *FieldOptions) GetIndex() bool
func (*FieldOptions) GetPk ¶
func (x *FieldOptions) GetPk() bool
func (*FieldOptions) GetRef ¶
func (x *FieldOptions) GetRef() string
func (*FieldOptions) GetSkip ¶
func (x *FieldOptions) GetSkip() bool
func (*FieldOptions) GetStore ¶
func (x *FieldOptions) GetStore() StoreAs
func (*FieldOptions) GetUnique ¶
func (x *FieldOptions) GetUnique() bool
func (*FieldOptions) GetValidate ¶
func (x *FieldOptions) GetValidate() *ValidationRules
func (*FieldOptions) ProtoMessage ¶
func (*FieldOptions) ProtoMessage()
func (*FieldOptions) ProtoReflect ¶
func (x *FieldOptions) ProtoReflect() protoreflect.Message
func (*FieldOptions) Reset ¶
func (x *FieldOptions) Reset()
func (*FieldOptions) String ¶
func (x *FieldOptions) String() string
type FrontendConfigOptions ¶
type FrontendConfigOptions struct {
// Frontend is the forge.yaml `frontends[].name` whose bundle loads this
// config — the same name `forge scaffold frontend` creates. A message
// annotated with a frontend that no forge.yaml declares is a
// generate-time error, not a silently unused config.
Frontend string `protobuf:"bytes,1,opt,name=frontend,proto3" json:"frontend,omitempty"`
// contains filtered or unexported fields
}
FrontendConfigOptions binds a config message to the FRONTEND that loads it, making a frontend a first-class consumer of the same declared, typed, defaulted config surface a binary gets.
It is the browser twin of BinaryConfigOptions and shares its reasoning: ownership is disjoint (a frontend's generated TypeScript module, KCL schema and per-env projection are built from the message carrying its name, so deleting a field from one frontend cannot reach another's), while DEFINITIONS may still be shared. The OIDC issuer both halves of an authenticated app need is ONE fact: compose a shared message onto both the binary's config and the frontend's, and the two cannot drift.
It differs from BinaryConfigOptions in exactly one way, and the difference is the point:
A BINARY's config may hold secrets. A FRONTEND's may not.
Everything a browser reads is public. A frontend's config is delivered to the client and is readable by anyone who opens devtools — there is no browser analogue of a Kubernetes Secret, and no amount of care at the deploy layer changes that. So `sensitive: true` — which on a binary means "this value comes from a Secret, never a literal env var" — has no safe meaning here at all.
forge therefore treats a sensitive field reaching a frontend config as a GENERATE-TIME ERROR rather than a warning or a runtime check. A warning would be discovered after the value had already shipped in a bundle, and a leaked credential cannot be un-shipped: the only useful moment to refuse is before the value is ever written down. Split the secret out into a binary-bound message and let the backend hold it; if the browser genuinely needs the capability, it needs a token minted by the backend, not the credential itself.
A project that annotates NOTHING is unchanged. Frontend config is opt-in.
func (*FrontendConfigOptions) Descriptor
deprecated
func (*FrontendConfigOptions) Descriptor() ([]byte, []int)
Deprecated: Use FrontendConfigOptions.ProtoReflect.Descriptor instead.
func (*FrontendConfigOptions) GetFrontend ¶
func (x *FrontendConfigOptions) GetFrontend() string
func (*FrontendConfigOptions) ProtoMessage ¶
func (*FrontendConfigOptions) ProtoMessage()
func (*FrontendConfigOptions) ProtoReflect ¶
func (x *FrontendConfigOptions) ProtoReflect() protoreflect.Message
func (*FrontendConfigOptions) Reset ¶
func (x *FrontendConfigOptions) Reset()
func (*FrontendConfigOptions) String ¶
func (x *FrontendConfigOptions) String() string
type IndexDef ¶
type IndexDef struct {
// Index name. Auto-generated from field names when left empty.
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
// Column names included in this index, in order.
Fields []string `protobuf:"bytes,2,rep,name=fields,proto3" json:"fields,omitempty"`
// Whether this index enforces a uniqueness constraint.
Unique bool `protobuf:"varint,3,opt,name=unique,proto3" json:"unique,omitempty"`
// contains filtered or unexported fields
}
IndexDef defines a database index on one or more columns.
DEPRECATED — Retired: ignored by forge. SQL is the schema — db/migrations drive entity projections. Declare indexes in migration SQL instead.
func (*IndexDef) Descriptor
deprecated
func (*IndexDef) ProtoMessage ¶
func (*IndexDef) ProtoMessage()
func (*IndexDef) ProtoReflect ¶
func (x *IndexDef) ProtoReflect() protoreflect.Message
type MethodOptions ¶
type MethodOptions struct {
// Whether this method requires authentication. Optional so the default
// (fail-closed: auth required) is distinguishable from an explicit
// `auth_required = false` opt-out at the proto level.
// Overrides the service-level AuthConfig.auth_required default.
AuthRequired *bool `protobuf:"varint,1,opt,name=auth_required,json=authRequired,proto3,oneof" json:"auth_required,omitempty"`
// Whether this method is idempotent (safe to retry without side effects).
Idempotent bool `protobuf:"varint,3,opt,name=idempotent,proto3" json:"idempotent,omitempty"`
// Server-side deadline for this method. forge projects it into
// pkg/middleware/procedures_gen.go (ProcedureDeadlines), which the
// scaffolded chain hands its Deadline slot; that slot runs ahead of
// authentication, so the deadline bounds the credential lookup too. Unset
// or zero is the slot's default (serverkit.DefaultUnaryDeadline for a unary
// rpc, none for a stream); negative is no server deadline.
Timeout *durationpb.Duration `protobuf:"bytes,4,opt,name=timeout,proto3" json:"timeout,omitempty"`
// Whether callers should supply an idempotency key for this method.
// This is a convention marker — Forge does not enforce or inspect the key.
// When set, tooling, docs, and generated clients advise callers to pass a
// unique key (e.g., an Idempotency-Key header) so the server can safely
// deduplicate retried mutations.
IdempotencyKey bool `protobuf:"varint,5,opt,name=idempotency_key,json=idempotencyKey,proto3" json:"idempotency_key,omitempty"`
// Declared Connect/gRPC error codes this method can return. Codegen
// surfaces these so handler authors (and LLMs implementing handlers)
// can see the typed error contract at a glance. Values match
// connect.Code names — e.g. "NotFound", "PermissionDenied",
// "InvalidArgument". Empty (or unset) means "no declared errors" — the
// method either succeeds or returns an undeclared Connect.Code.
//
// The list is informational at runtime today; future work may enforce
// that handlers can only return declared codes.
Errors []string `protobuf:"bytes,6,rep,name=errors,proto3" json:"errors,omitempty"`
// Activity declares the typed activity event a successful call records:
// who (the caller) did what (verb) to which object (target), where (env)
// and through what (via). forge/pkg/activity's interceptor reads this
// option from the method descriptor and writes the event, so no handler
// writes one by hand; `forge lint` fails a mutating rpc that declares
// nothing (forgeconv-activity-declared). See ActivityOptions.
Activity *ActivityOptions `protobuf:"bytes,7,opt,name=activity,proto3" json:"activity,omitempty"`
// contains filtered or unexported fields
}
MethodOptions defines per-method behavior annotations for Connect RPC methods. Apply via [(forge.v1.method) = { ... }] on any rpc definition.
func (*MethodOptions) Descriptor
deprecated
func (*MethodOptions) Descriptor() ([]byte, []int)
Deprecated: Use MethodOptions.ProtoReflect.Descriptor instead.
func (*MethodOptions) GetActivity ¶ added in v1.0.0
func (x *MethodOptions) GetActivity() *ActivityOptions
func (*MethodOptions) GetAuthRequired ¶
func (x *MethodOptions) GetAuthRequired() bool
func (*MethodOptions) GetErrors ¶
func (x *MethodOptions) GetErrors() []string
func (*MethodOptions) GetIdempotencyKey ¶
func (x *MethodOptions) GetIdempotencyKey() bool
func (*MethodOptions) GetIdempotent ¶
func (x *MethodOptions) GetIdempotent() bool
func (*MethodOptions) GetTimeout ¶
func (x *MethodOptions) GetTimeout() *durationpb.Duration
func (*MethodOptions) ProtoMessage ¶
func (*MethodOptions) ProtoMessage()
func (*MethodOptions) ProtoReflect ¶
func (x *MethodOptions) ProtoReflect() protoreflect.Message
func (*MethodOptions) Reset ¶
func (x *MethodOptions) Reset()
func (*MethodOptions) String ¶
func (x *MethodOptions) String() string
type ServiceOptions ¶
type ServiceOptions struct {
// Human-readable service name used in code generation and logging.
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
// API version string (e.g., "v1", "v2beta1").
Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
// Brief description of the service's purpose.
Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
// Controls how the service is exposed.
Visibility ServiceVisibility `protobuf:"varint,4,opt,name=visibility,proto3,enum=forge.v1.ServiceVisibility" json:"visibility,omitempty"`
// Other services this service depends on (for dependency injection).
Dependencies []string `protobuf:"bytes,5,rep,name=dependencies,proto3" json:"dependencies,omitempty"`
// Authentication configuration for the service.
Auth *AuthConfig `protobuf:"bytes,6,opt,name=auth,proto3" json:"auth,omitempty"`
// The trust domain whose callers this service serves: "user" (the
// default, when empty) for the product's own signed-in users, or a name
// the project chooses for another kind of caller ("daemon", "operator").
// A serverkit.Listener refuses to start when it mounts a service whose
// audience differs from its chain's Authenticator.Audience(), so a
// listener authenticating one kind of caller can never serve another
// kind's RPCs.
Audience string `protobuf:"bytes,7,opt,name=audience,proto3" json:"audience,omitempty"`
// contains filtered or unexported fields
}
ServiceOptions defines metadata and behavior for a Connect RPC service. Apply via [(forge.v1.service) = { ... }] on any service definition.
func (*ServiceOptions) Descriptor
deprecated
func (*ServiceOptions) Descriptor() ([]byte, []int)
Deprecated: Use ServiceOptions.ProtoReflect.Descriptor instead.
func (*ServiceOptions) GetAudience ¶ added in v0.1.46
func (x *ServiceOptions) GetAudience() string
func (*ServiceOptions) GetAuth ¶
func (x *ServiceOptions) GetAuth() *AuthConfig
func (*ServiceOptions) GetDependencies ¶
func (x *ServiceOptions) GetDependencies() []string
func (*ServiceOptions) GetDescription ¶
func (x *ServiceOptions) GetDescription() string
func (*ServiceOptions) GetName ¶
func (x *ServiceOptions) GetName() string
func (*ServiceOptions) GetVersion ¶
func (x *ServiceOptions) GetVersion() string
func (*ServiceOptions) GetVisibility ¶
func (x *ServiceOptions) GetVisibility() ServiceVisibility
func (*ServiceOptions) ProtoMessage ¶
func (*ServiceOptions) ProtoMessage()
func (*ServiceOptions) ProtoReflect ¶
func (x *ServiceOptions) ProtoReflect() protoreflect.Message
func (*ServiceOptions) Reset ¶
func (x *ServiceOptions) Reset()
func (*ServiceOptions) String ¶
func (x *ServiceOptions) String() string
type ServiceVisibility ¶
type ServiceVisibility int32
ServiceVisibility determines how a service is exposed.
const ( // Unspecified; defaults to API visibility. ServiceVisibility_SERVICE_VISIBILITY_UNSPECIFIED ServiceVisibility = 0 // Exposed via HTTP/Connect gateway. ServiceVisibility_SERVICE_VISIBILITY_API ServiceVisibility = 1 // Only accessible for inter-service communication. ServiceVisibility_SERVICE_VISIBILITY_INTERNAL ServiceVisibility = 2 )
func (ServiceVisibility) Descriptor ¶
func (ServiceVisibility) Descriptor() protoreflect.EnumDescriptor
func (ServiceVisibility) Enum ¶
func (x ServiceVisibility) Enum() *ServiceVisibility
func (ServiceVisibility) EnumDescriptor
deprecated
func (ServiceVisibility) EnumDescriptor() ([]byte, []int)
Deprecated: Use ServiceVisibility.Descriptor instead.
func (ServiceVisibility) Number ¶
func (x ServiceVisibility) Number() protoreflect.EnumNumber
func (ServiceVisibility) String ¶
func (x ServiceVisibility) String() string
func (ServiceVisibility) Type ¶
func (ServiceVisibility) Type() protoreflect.EnumType
type StoreAs ¶
type StoreAs int32
StoreAs controls how complex or non-scalar protobuf types are persisted in the database.
DEPRECATED — Retired: ignored by forge. SQL is the schema — db/migrations drive entity projections. Column storage types live in migration SQL.
const ( // Inferred from the protobuf type (default behavior). StoreAs_STORE_AS_UNSPECIFIED StoreAs = 0 // Store as a JSONB column (PostgreSQL) or JSON text (SQLite). StoreAs_STORE_AS_JSONB StoreAs = 1 // Store as a TEXT column. StoreAs_STORE_AS_TEXT StoreAs = 2 // Store as a BLOB / BYTEA column. StoreAs_STORE_AS_BLOB StoreAs = 3 // Store in a separate table with a foreign key relationship. StoreAs_STORE_AS_TABLE StoreAs = 4 )
func (StoreAs) Descriptor ¶
func (StoreAs) Descriptor() protoreflect.EnumDescriptor
func (StoreAs) EnumDescriptor
deprecated
func (StoreAs) Number ¶
func (x StoreAs) Number() protoreflect.EnumNumber
func (StoreAs) Type ¶
func (StoreAs) Type() protoreflect.EnumType
type ValidationRules ¶
type ValidationRules struct {
// Field value is required (must be non-zero-value).
Required bool `protobuf:"varint,1,opt,name=required,proto3" json:"required,omitempty"`
// Minimum length for string fields.
MinLength int32 `protobuf:"varint,2,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"`
// Maximum length for string fields.
MaxLength int32 `protobuf:"varint,3,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"`
// Regex pattern the value must match.
Pattern string `protobuf:"bytes,4,opt,name=pattern,proto3" json:"pattern,omitempty"`
// Semantic format constraint (e.g., "email", "url", "uuid", "ip").
Format string `protobuf:"bytes,5,opt,name=format,proto3" json:"format,omitempty"`
// Minimum value for numeric fields.
Min float64 `protobuf:"fixed64,6,opt,name=min,proto3" json:"min,omitempty"`
// Maximum value for numeric fields.
Max float64 `protobuf:"fixed64,7,opt,name=max,proto3" json:"max,omitempty"`
// Allowed values (for enum-like string fields).
AllowedValues []string `protobuf:"bytes,8,rep,name=allowed_values,json=allowedValues,proto3" json:"allowed_values,omitempty"`
// Custom validation function name to call during validation.
Custom string `protobuf:"bytes,9,opt,name=custom,proto3" json:"custom,omitempty"`
// contains filtered or unexported fields
}
ValidationRules defines application-layer constraints enforced during code generation. These do not affect the database schema directly.
func (*ValidationRules) Descriptor
deprecated
func (*ValidationRules) Descriptor() ([]byte, []int)
Deprecated: Use ValidationRules.ProtoReflect.Descriptor instead.
func (*ValidationRules) GetAllowedValues ¶
func (x *ValidationRules) GetAllowedValues() []string
func (*ValidationRules) GetCustom ¶
func (x *ValidationRules) GetCustom() string
func (*ValidationRules) GetFormat ¶
func (x *ValidationRules) GetFormat() string
func (*ValidationRules) GetMax ¶
func (x *ValidationRules) GetMax() float64
func (*ValidationRules) GetMaxLength ¶
func (x *ValidationRules) GetMaxLength() int32
func (*ValidationRules) GetMin ¶
func (x *ValidationRules) GetMin() float64
func (*ValidationRules) GetMinLength ¶
func (x *ValidationRules) GetMinLength() int32
func (*ValidationRules) GetPattern ¶
func (x *ValidationRules) GetPattern() string
func (*ValidationRules) GetRequired ¶
func (x *ValidationRules) GetRequired() bool
func (*ValidationRules) ProtoMessage ¶
func (*ValidationRules) ProtoMessage()
func (*ValidationRules) ProtoReflect ¶
func (x *ValidationRules) ProtoReflect() protoreflect.Message
func (*ValidationRules) Reset ¶
func (x *ValidationRules) Reset()
func (*ValidationRules) String ¶
func (x *ValidationRules) String() string