Documentation
¶
Index ¶
- Constants
- Variables
- func ClearProvenance(ctx context.Context, store variablestore.Store, scope variablestore.Scope) error
- func DedupeKey(ctx context.Context, store variablestore.Store, scope variablestore.Scope, ...) (string, error)
- func ForgetDigestKey(ctx context.Context, store records.Store, tier environment.Tier) error
- func ForgetProject(ctx context.Context, store variablestore.Store, tier environment.Tier, ...) error
- func ReadCredentials(ctx context.Context, store variablestore.Store, scope variablestore.Scope, ...) ([]string, error)
- func RestoreRegistration(ctx context.Context, store variablestore.Store, tier environment.Tier, ...) error
- func ScheduledProjects(ctx context.Context, store records.Store, tier environment.Tier) ([]string, error)
- func SetCommand(tier environment.Tier, name string) string
- func Unregister(ctx context.Context, store variablestore.Store, tier environment.Tier, ...) error
- type Config
- type CopyResult
- type Credential
- type CredentialError
- type Descriptor
- func (d Descriptor) CanCreate() bool
- func (d Descriptor) CanUpdate() bool
- func (d Descriptor) CredentialVariables() []string
- func (d Descriptor) ID() string
- func (d Descriptor) Kind() string
- func (d Descriptor) MarshalJSON() ([]byte, error)
- func (d Descriptor) Open(dir string, lookupEnv func(string) (string, bool)) (Source, error)
- func (d Descriptor) Options() json.RawMessage
- func (d Descriptor) Reading() Reading
- func (d Descriptor) RefuseLogin(login Login) error
- func (d *Descriptor) UnmarshalJSON(data []byte) error
- type DigestKey
- type ExecOptions
- type Format
- type IdentityAuth
- type IdentityProof
- type InfisicalAuth
- type InfisicalOptions
- type Kind
- type Login
- type OptionError
- type Reading
- type Registration
- func Register(ctx context.Context, store variablestore.Store, tier environment.Tier, ...) (Registration, error)
- func Registered(ctx context.Context, store records.Store, tier environment.Tier, ...) (Registration, bool, error)
- func Registrations(ctx context.Context, store records.Store, tier environment.Tier) ([]Registration, error)
- type SignedRequest
- type Source
- type Status
- type Sync
- func (s *Sync) CopyProject(ctx context.Context, registration Registration) (CopyResult, error)
- func (s *Sync) CopyProjectFrom(ctx context.Context, registration Registration, source Source) (CopyResult, error)
- func (s *Sync) CopyScheduled(ctx context.Context) error
- func (s *Sync) CopyScheduledEveryInterval(ctx context.Context, report func(error))
- func (s *Sync) Open(ctx context.Context, registration Registration) (Source, error)
- type Tiers
- type UndecodableRegistrationError
- type UniversalAuth
- type Value
- type Variable
- type WritePolicy
Constants ¶
View Source
const ( Builtin = "builtin" Dotenv = "dotenv" )
View Source
const ( RootRegistrations records.Root = "envsources" RootStatus records.Root = "envsourcestatus" RootDigestKey records.Root = "envsourcedigestkey" )
View Source
const FolderPlaceholder = "{folder}"
View Source
const VariableNamePattern = `^[^#\x00-\x1f\x7f]*$`
Variables ¶
View Source
var ( ErrExists = errors.New("envsource: the env source already has that key") ErrReadOnly = errors.New("envsource: ocel may not write into the env source") ErrAwaitingApproval = errors.New("envsource: the env source queued the write for approval") ErrChangedSinceRead = errors.New("envsource: the value changed in the env source since ocel last read it") ErrNotInFolder = errors.New("envsource: the env source keeps no such key in that folder itself") )
Functions ¶
func ClearProvenance ¶
func ClearProvenance(ctx context.Context, store variablestore.Store, scope variablestore.Scope) error
func DedupeKey ¶
func DedupeKey(ctx context.Context, store variablestore.Store, scope variablestore.Scope, descriptor Descriptor) (string, error)
func ForgetDigestKey ¶
func ForgetProject ¶
func ForgetProject(ctx context.Context, store variablestore.Store, tier environment.Tier, project string) error
func ReadCredentials ¶
func ReadCredentials(ctx context.Context, store variablestore.Store, scope variablestore.Scope, descriptor Descriptor) ([]string, error)
func RestoreRegistration ¶
func RestoreRegistration(ctx context.Context, store variablestore.Store, tier environment.Tier, replacing Registration, previous *Registration) error
func ScheduledProjects ¶
func SetCommand ¶
func SetCommand(tier environment.Tier, name string) string
func Unregister ¶
func Unregister(ctx context.Context, store variablestore.Store, tier environment.Tier, project string) error
Types ¶
type Config ¶
func (*Config) NamedAlone ¶
type CopyResult ¶
type CopyResult struct {
EnvSource string
Present []variablestore.Cell
Written []variablestore.Cell
Unchanged []variablestore.Cell
Removed []variablestore.Cell
Refused map[variablestore.Cell]string
// contains filtered or unexported fields
}
func CopyValues ¶
func CopyValues(ctx context.Context, store variablestore.Store, scope variablestore.Scope, listed []variablestore.Metadata, key DigestKey, envSource string, readAt time.Time, read map[variablestore.Cell]Value, folders []string, keep []variablestore.Cell) (CopyResult, error)
type Credential ¶
type Credential interface {
// contains filtered or unexported methods
}
func AccessToken ¶
func AccessToken(token string) Credential
func IdentityCredential ¶
func IdentityCredential(identityID string, proveIdentity func(ctx context.Context, audience string) (IdentityProof, error)) Credential
func UniversalCredential ¶
func UniversalCredential(clientID, clientSecret string) Credential
type CredentialError ¶
func (*CredentialError) Error ¶
func (e *CredentialError) Error() string
type Descriptor ¶
type Descriptor struct {
// contains filtered or unexported fields
}
func NewDescriptor ¶
func NewDescriptor(kind string, options json.RawMessage) (Descriptor, error)
func NewDevDescriptor ¶
func NewDevDescriptor(kind string, options json.RawMessage) (Descriptor, error)
func (Descriptor) CanCreate ¶
func (d Descriptor) CanCreate() bool
func (Descriptor) CanUpdate ¶
func (d Descriptor) CanUpdate() bool
func (Descriptor) CredentialVariables ¶
func (d Descriptor) CredentialVariables() []string
func (Descriptor) ID ¶
func (d Descriptor) ID() string
func (Descriptor) Kind ¶
func (d Descriptor) Kind() string
func (Descriptor) MarshalJSON ¶
func (d Descriptor) MarshalJSON() ([]byte, error)
func (Descriptor) Options ¶
func (d Descriptor) Options() json.RawMessage
func (Descriptor) Reading ¶
func (d Descriptor) Reading() Reading
func (Descriptor) RefuseLogin ¶
func (d Descriptor) RefuseLogin(login Login) error
func (*Descriptor) UnmarshalJSON ¶
func (d *Descriptor) UnmarshalJSON(data []byte) error
type DigestKey ¶
type DigestKey struct {
// contains filtered or unexported fields
}
func EnsureDigestKey ¶
func EnsureDigestKey(ctx context.Context, store variablestore.Store, tier environment.Tier) (DigestKey, error)
type ExecOptions ¶
type ExecOptions struct {
Command []string `json:"command" doc:"The command and its arguments. {folder} in an argument becomes the variables folder being read."`
Format Format `json:"format" enum:"json,dotenv" doc:"What the command prints: a JSON object of names to values, or KEY=VALUE lines."`
}
func (ExecOptions) Doc ¶
func (ExecOptions) Doc() string
type IdentityAuth ¶
type IdentityAuth struct {
IdentityID string `json:"identityId" doc:"The id of the Infisical machine identity to sign in as."`
}
func (IdentityAuth) Doc ¶
func (IdentityAuth) Doc() string
type IdentityProof ¶
type IdentityProof struct {
SignedRequest *SignedRequest
IDToken string
}
type InfisicalAuth ¶
type InfisicalAuth struct {
Universal *UniversalAuth `json:"universal,omitempty" doc:"Universal Auth: a client id and client secret, each an ocel variable."`
Identity *IdentityAuth `json:"identity,omitempty" doc:"This target's own cloud identity signs in, so no secret is stored."`
}
func (InfisicalAuth) Doc ¶
func (InfisicalAuth) Doc() string
func (InfisicalAuth) Shorthands ¶
func (InfisicalAuth) Shorthands() []string
func (*InfisicalAuth) Variables ¶
func (a *InfisicalAuth) Variables() []string
type InfisicalOptions ¶
type InfisicalOptions struct {
Project string `json:"project" doc:"The id of the Infisical project the values live in."`
Environment string `json:"environment" doc:"The slug of the Infisical environment this tier reads, such as prod."`
Path string `json:"path,omitempty" doc:"The Infisical folder the project's values sit under. Left off, the environment's root, /."`
Host string `json:"host,omitempty" doc:"The base URL of a self-hosted Infisical. Left off, https://app.infisical.com."`
Auth *InfisicalAuth `` /* 136-byte string literal not displayed */
Write WritePolicy `` /* 182-byte string literal not displayed */
}
func (InfisicalOptions) Doc ¶
func (InfisicalOptions) Doc() string
func (InfisicalOptions) ID ¶
func (o InfisicalOptions) ID() string
func (InfisicalOptions) Normalize ¶
func (o InfisicalOptions) Normalize() InfisicalOptions
type OptionError ¶
func (*OptionError) Error ¶
func (e *OptionError) Error() string
type Registration ¶
type Registration struct {
Project string `json:"project"`
Descriptor Descriptor `json:"descriptor"`
Folders []string `json:"folders"`
DedupeKey string `json:"dedupeKey"`
}
func Register ¶
func Register(ctx context.Context, store variablestore.Store, tier environment.Tier, registration Registration) (Registration, error)
func Registered ¶
func Registered(ctx context.Context, store records.Store, tier environment.Tier, project string) (Registration, bool, error)
func Registrations ¶
func Registrations(ctx context.Context, store records.Store, tier environment.Tier) ([]Registration, error)
func (Registration) Credentials ¶
func (r Registration) Credentials() []variablestore.Cell
type SignedRequest ¶
type Source ¶
type Source interface {
ID() string
Read(ctx context.Context, folders []string) (map[variablestore.Cell]Value, error)
Create(ctx context.Context, at variablestore.Cell, value []byte, description string) error
Update(ctx context.Context, at variablestore.Cell, value []byte, copiedVersion string) error
URL(at variablestore.Cell) string
}
func NewInfisical ¶
func NewInfisical(options InfisicalOptions, credential Credential, client *http.Client) Source
type Status ¶
type Status struct {
EnvSource string `json:"envSource"`
LastAttemptAt time.Time `json:"lastAttemptAt,omitzero"`
LastSuccessAt time.Time `json:"lastSuccessAt,omitzero"`
LastError string `json:"lastError,omitempty"`
ConsecutiveFailures int `json:"consecutiveFailures,omitempty"`
RetryAt time.Time `json:"retryAt,omitzero"`
URLs map[string]string `json:"urls,omitempty"`
}
func StatusOf ¶
func StatusOf(ctx context.Context, store variablestore.Store, tier environment.Tier, registration Registration) (Status, error)
type Sync ¶
type Sync struct {
Store variablestore.Store
Tier environment.Tier
Login Login
Now func() time.Time
Interval time.Duration
// contains filtered or unexported fields
}
func (*Sync) CopyProject ¶
func (s *Sync) CopyProject(ctx context.Context, registration Registration) (CopyResult, error)
func (*Sync) CopyProjectFrom ¶
func (s *Sync) CopyProjectFrom(ctx context.Context, registration Registration, source Source) (CopyResult, error)
func (*Sync) CopyScheduledEveryInterval ¶
type Tiers ¶
type Tiers struct {
Production Descriptor
Preview Descriptor
Dev Descriptor
}
func DefaultTiers ¶
func DefaultTiers() Tiers
type UndecodableRegistrationError ¶
func (*UndecodableRegistrationError) Error ¶
func (e *UndecodableRegistrationError) Error() string
func (*UndecodableRegistrationError) Unwrap ¶
func (e *UndecodableRegistrationError) Unwrap() error
type UniversalAuth ¶
type UniversalAuth struct {
ClientID Variable `json:"clientId" doc:"The ocel variable containing the Universal Auth client id."`
ClientSecret Variable `json:"clientSecret" doc:"The ocel variable containing the Universal Auth client secret."`
}
func (UniversalAuth) Doc ¶
func (UniversalAuth) Doc() string
type WritePolicy ¶
type WritePolicy string
const ( WriteNever WritePolicy = "never" WriteMissing WritePolicy = "missing" WriteValues WritePolicy = "values" )
Click to show internal directories.
Click to hide internal directories.