utility

package
v0.0.34 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: MIT Imports: 7 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromContext

func FromContext(ctx context.Context, key ContextKey) (string, bool)

func Load

func Load(spec any) error

Load from environment and vault

func NewContext

func NewContext(ctx context.Context, key ContextKey, value string) context.Context

Types

type ContextKey

type ContextKey string
const (
	TokenContextKey ContextKey = "bearer"
	UIDContextKey   ContextKey = "uid"
)

func (ContextKey) String

func (c ContextKey) String() string

type Deployments

type Deployments string
const (
	DeploymentsLocal Deployments = "local"
	DeploymentsDev   Deployments = "dev"
	DeploymentsProd  Deployments = "prod"
)

func ParseDeployments

func ParseDeployments(value string) Deployments

func (Deployments) IsDev

func (d Deployments) IsDev() bool

IsDev returns true if the deployment contains "dev", e.g. "dev", "dev_test", "dev_load"... etc

func (Deployments) IsLocal

func (d Deployments) IsLocal() bool

IsLocal returns true if the deployment contains "local", e.g. "local", "local_67", "local_name"... etc

func (Deployments) IsProd

func (d Deployments) IsProd() bool

IsProd returns true if the deployment contains "prod", e.g. "prod", "prod_gcp", "prod_aws"... etc

func (Deployments) String

func (d Deployments) String() string

type Tag

type Tag string

Tag is the type for the auth tag,

const WithOutTag Tag = "auth.disabled"

func (Tag) String

func (t Tag) String() string

type WithoutAuth

type WithoutAuth struct {
}

WithoutAuth overrides the default auth behavior and allows all methods to be called without an access token.

func (*WithoutAuth) AuthFuncOverride

func (w *WithoutAuth) AuthFuncOverride(ctx context.Context, _ string) (context.Context, error)

AuthFuncOverride allows all methods to be unauthenticated.

Jump to

Keyboard shortcuts

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