config

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2023 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidGoogleCreds   = errors.New("invalid google application credentials")
	ErrInvalidStorageBucket = errors.New("invalid storage bucket")
)
View Source
var (
	HomePath = os.Getenv("HOME")
	Dir      = filepath.Join(HomePath, ".config", "dolores")
	File     = filepath.Join(Dir, "dolores.json")
)
View Source
var ErrInvalidDoloresConfig = errors.New("invalid dolores config")

Functions

func MetadataFileName

func MetadataFileName() string

Types

type Backend

type Backend struct {
	URL *url.URL
}

type Client

type Client struct {
	Google
}

func LoadClient

func LoadClient(ctx context.Context, env string) (Client, error)

func (Client) BucketName

func (c Client) BucketName() string

func (Client) Valid

func (c Client) Valid() error

type CtxKey

type CtxKey string
var (
	EnvKey   CtxKey = "ctx_environment"
	CredsKey CtxKey = "ctx_application_creds"
)

type Dolores

type Dolores struct {
	Environments map[string]Environment `json:"environments"`
}

func LoadFromDisk

func LoadFromDisk() (*Dolores, error)

func (*Dolores) AddEnvironment

func (d *Dolores) AddEnvironment(env string, keyFile string, md Metadata)

func (Dolores) SaveToDisk

func (d Dolores) SaveToDisk() error

type Environment

type Environment struct {
	Metadata `json:"metadata"`
	KeyFile  string `json:"key_file"`
}

type Google

type Google struct {
	ApplicationCredentials string `split_words:"true"`
	StorageBucket          string `split_words:"true"`
	StoragePrefix          string
}

type Metadata

type Metadata struct {
	Bucket      string    `json:"bucket"`
	Location    string    `json:"location"`
	Environment string    `json:"environment"`
	CreatedAt   time.Time `json:"created_at"`
}

type Server

type Server struct {
	Port int
	Host string
}

func (Server) Address

func (s Server) Address() string

Jump to

Keyboard shortcuts

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