Documentation
¶
Overview ¶
Package variables keeps global and per-stack variables (#35, ADR-0049). They are encrypted in the database and passed to `nerdctl compose` as environment variables, so compose files interpolate them as ${NAME} and they take precedence over the stack's .env file. Secret values are never returned by the API.
Index ¶
- Constants
- func ValidateName(name string) error
- type Input
- type Service
- func (s *Service) Delete(ctx context.Context, stack, name string) error
- func (s *Service) DeleteStack(ctx context.Context, stack string) error
- func (s *Service) List(ctx context.Context, stack string) ([]Variable, error)
- func (s *Service) Put(ctx context.Context, stack, name string, in Input, user string) (Variable, error)
- func (s *Service) Values(ctx context.Context, stack string) (map[string]string, error)
- type Store
- type Variable
Constants ¶
const Global = ""
Global is the scope of variables shared by all stacks.
const (
// MaxValue is the largest value in bytes.
MaxValue = 64 << 10
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Input ¶
Input changes a variable. A nil Value keeps the stored one; it is required for a new variable and to make a secret visible.
type Service ¶
Service manages variables.
func (*Service) DeleteStack ¶
DeleteStack removes the variables of a stack that nerdui forgets, so a later stack of the same name does not get them.
func (*Service) List ¶
List returns the variables of a scope (Global or a stack name) without secret values.
type Store ¶
type Store interface {
ListVariables(ctx context.Context, stack string) ([]db.Variable, error)
GetVariable(ctx context.Context, arg db.GetVariableParams) (db.Variable, error)
PutVariable(ctx context.Context, arg db.PutVariableParams) error
DeleteVariable(ctx context.Context, arg db.DeleteVariableParams) (int64, error)
DeleteStackVariables(ctx context.Context, stack string) error
}
Store is the database; *db.Queries implements it.
type Variable ¶
type Variable struct {
Name string `json:"name"`
// Value is empty for secrets.
Value string `json:"value"`
Secret bool `json:"secret"`
UpdatedBy string `json:"updatedBy,omitempty"`
UpdatedAt time.Time `json:"updatedAt"`
}
Variable as the API shows it. Keep in sync with api/openapi.yaml.