runtimectx

package
v0.365.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContextIdentityField        = "identity"
	ContextIsAuthenticatedField = "isAuthenticated"
	ContextNowField             = "now"
	ContextEnvField             = "env"
	ContextSecretField          = "secret"
)
View Source
const ContextTarget string = "ctx"
View Source
const (
	ExternalIssuersEnvKey string = "KEEL_EXTERNAL_ISSUERS"
)
View Source
const (
	SecretContextKey secretContextKey = "secret"
)

Variables

Functions

func GetAuthConfig

func GetAuthConfig(ctx context.Context) (*auth.AuthConfig, error)

func GetDatabase

func GetDatabase(ctx context.Context) (db.Database, error)

func GetMailClient

func GetMailClient(ctx context.Context) (mail.EmailClient, error)

func GetNow

func GetNow() time.Time

func GetPrivateKey

func GetPrivateKey(ctx context.Context) (*rsa.PrivateKey, error)

func GetRequestHeaders

func GetRequestHeaders(ctx context.Context) (map[string][]string, error)

func GetSecret

func GetSecret(ctx context.Context, secret string) (string, error)

func GetSecrets

func GetSecrets(ctx context.Context) map[string]string

func IsAuthenticated

func IsAuthenticated(ctx context.Context) bool

func WithAuthConfig

func WithAuthConfig(ctx context.Context, config auth.AuthConfig) context.Context

func WithDatabase

func WithDatabase(ctx context.Context, database db.Database) context.Context

func WithEnv

func WithEnv(ctx context.Context, env KeelEnv) context.Context

func WithIdentity

func WithIdentity(ctx context.Context, identity *Identity) context.Context

func WithIssuersFromEnv

func WithIssuersFromEnv(ctx context.Context) context.Context

Backwards compatibility with the previous env var config.

func WithMailClient

func WithMailClient(ctx context.Context, client mail.EmailClient) context.Context

func WithPrivateKey

func WithPrivateKey(ctx context.Context, privateKey *rsa.PrivateKey) context.Context

func WithRequestHeaders

func WithRequestHeaders(ctx context.Context, headers map[string][]string) context.Context

func WithSecrets

func WithSecrets(ctx context.Context, secrets map[string]string) context.Context

Types

type EnvKeyContextType

type EnvKeyContextType string

type Identity

type Identity struct {
	Id         string    `json:"id"`
	ExternalId string    `json:"externalId"`
	Email      string    `json:"email"`
	Password   string    `json:"-"`
	Issuer     string    `json:"issuer"`
	CreatedAt  time.Time `json:"createdAt"`
	UpdatedAt  time.Time `json:"updatedAt"`
}

func GetIdentity

func GetIdentity(ctx context.Context) (*Identity, error)

type KeelEnv

type KeelEnv string
const (
	// The Test environment denotes any Keel environment that isn't production or staging. So this includes the
	// runtime inside of the Keel Test Framework runner, as well as the runtime locally (e.g 'keel run' in the CLI)
	KeelEnvTest       KeelEnv = "test"
	KeelEnvProduction KeelEnv = "production"
)

func GetEnv

func GetEnv(ctx context.Context) KeelEnv

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL