config

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2021 License: Apache-2.0 Imports: 2 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEnv added in v1.16.0

func GetEnv(cfg *Config) []string

GetEnv fetches a list of known env variables for this extension. It is to be used by gookit, as it provides a list with all the environment variables an extension supports.

func StructMappings added in v1.16.0

func StructMappings(cfg *Config) []shared.EnvBinding

StructMappings binds a set of environment variables to a destination on cfg. Iterating over this set and editing the Destination value of a binding will alter the original value, as it is a pointer to its memory address. This lets us propagate changes easier.

Types

type Asset

type Asset struct {
	Path string `ocisConfig:"path"`
}

Asset defines the available asset configuration.

type Config

type Config struct {
	*shared.Commons

	File    string      `ocisConfig:"file"`
	Log     *shared.Log `ocisConfig:"log"`
	Debug   Debug       `ocisConfig:"debug"`
	HTTP    HTTP        `ocisConfig:"http"`
	Tracing Tracing     `ocisConfig:"tracing"`
	Asset   Asset       `ocisConfig:"asset"`
	Web     Web         `ocisConfig:"web"`

	Context    context.Context
	Supervised bool
}

Config combines all available configuration parts.

func DefaultConfig added in v1.16.0

func DefaultConfig() *Config

func New

func New() *Config

New initializes a new configuration with or without defaults.

type Debug

type Debug struct {
	Addr   string `ocisConfig:"addr"`
	Token  string `ocisConfig:"token"`
	Pprof  bool   `ocisConfig:"pprof"`
	Zpages bool   `ocisConfig:"zpages"`
}

Debug defines the available debug configuration.

type ExternalApp

type ExternalApp struct {
	ID   string `json:"id,omitempty" ocisConfig:"id"`
	Path string `json:"path,omitempty" ocisConfig:"path"`
	// Config is completely dynamic, because it depends on the extension
	Config map[string]interface{} `json:"config,omitempty" ocisConfig:"config"`
}

ExternalApp defines an external web app.

{
	"name": "hello",
	"path": "http://localhost:9105/hello.js",
	  "config": {
	    "url": "http://localhost:9105"
	  }
 }

type ExternalAppConfig

type ExternalAppConfig struct {
	URL string `json:"url,omitempty" ocisConfig:"url"`
}

ExternalAppConfig defines an external web app configuration.

type HTTP

type HTTP struct {
	Addr      string `ocisConfig:"addr"`
	Root      string `ocisConfig:"root"`
	Namespace string `ocisConfig:"namespace"`
	CacheTTL  int    `ocisConfig:"cache_ttl"`
}

HTTP defines the available http configuration.

type OIDC

type OIDC struct {
	MetadataURL  string `json:"metadata_url,omitempty" ocisConfig:"metadata_url"`
	Authority    string `json:"authority,omitempty" ocisConfig:"authority"`
	ClientID     string `json:"client_id,omitempty" ocisConfig:"client_id"`
	ResponseType string `json:"response_type,omitempty" ocisConfig:"response_type"`
	Scope        string `json:"scope,omitempty" ocisConfig:"scope"`
}

OIDC defines the available oidc configuration

type Tracing

type Tracing struct {
	Enabled   bool   `ocisConfig:"enabled"`
	Type      string `ocisConfig:"type"`
	Endpoint  string `ocisConfig:"endpoint"`
	Collector string `ocisConfig:"collector"`
	Service   string `ocisConfig:"service"`
}

Tracing defines the available tracing configuration.

type Web

type Web struct {
	Path        string    `ocisConfig:"path"`
	ThemeServer string    `ocisConfig:"theme_server"` // used to build Theme in WebConfig
	ThemePath   string    `ocisConfig:"theme_path"`   // used to build Theme in WebConfig
	Config      WebConfig `ocisConfig:"config"`
}

Web defines the available web configuration.

type WebConfig

type WebConfig struct {
	Server        string                 `json:"server,omitempty" ocisConfig:"server"`
	Theme         string                 `json:"theme,omitempty" ocisConfig:"theme"`
	Version       string                 `json:"version,omitempty" ocisConfig:"version"`
	OpenIDConnect OIDC                   `json:"openIdConnect,omitempty" ocisConfig:"oids"`
	Apps          []string               `json:"apps" ocisConfig:"apps"`
	ExternalApps  []ExternalApp          `json:"external_apps,omitempty" ocisConfig:"external_apps"`
	Options       map[string]interface{} `json:"options,omitempty" ocisConfig:"options"`
}

WebConfig defines the available web configuration for a dynamically rendered config.json.

Jump to

Keyboard shortcuts

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