config

package
v0.1.73 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CamundaApiKeyConst      = "camunda_api"
	CamundaApiVersionConst  = "v2"
	OperateApiKeyConst      = "operate_api"
	OperateApiVersionConst  = "" // v1 by default from client side
	TasklistApiKeyConst     = "tasklist_api"
	TasklistApiVersionConst = "" // v1 by default from client side
)

Variables

View Source
var (
	ErrNoBaseURL      = errors.New("no base_url provided in api configuration")
	ErrNoTokenURL     = errors.New("no token_url provided in auth configuration")
	ErrNoClientID     = errors.New("no client_id provided in auth configuration")
	ErrNoClientSecret = errors.New("no client_secret provided in auth configuration")

	ErrNoConfigInContext       = errors.New("no config in context")
	ErrInvalidServiceInContext = errors.New("invalid config in context")

	ErrInvalidLogLevel  = errors.New("invalid log.level")
	ErrInvalidLogFormat = errors.New("invalid log.format")
)

Functions

This section is empty.

Types

type API

type API struct {
	Key          string `mapstructure:"key" json:"key" yaml:"key"`
	BaseURL      string `mapstructure:"base_url" json:"base_url" yaml:"base_url"`
	RequireScope bool   `mapstructure:"require_scope" json:"require_scope" yaml:"require_scope"`
	Version      string `mapstructure:"version" json:"version" yaml:"version"`
}

type APIs

type APIs struct {
	Camunda               API  `mapstructure:"camunda_api" json:"camunda_api" yaml:"camunda_api"`
	Operate               API  `mapstructure:"operate_api" json:"operate_api" yaml:"operate_api"`
	Tasklist              API  `mapstructure:"tasklist_api" json:"tasklist_api" yaml:"tasklist_api"`
	DisableAutoVersioning bool `mapstructure:"disable_auto_versioning" json:"disable_auto_versioning" yaml:"disable_auto_versioning"`
}

func (*APIs) Normalize

func (a *APIs) Normalize() error

func (*APIs) Validate

func (a *APIs) Validate(scopes Scopes) error

type App

type App struct {
	CamundaVersion toolx.CamundaVersion `mapstructure:"camunda_version" json:"camunda_version" yaml:"camunda_version"`
	Tenant         string               `mapstructure:"tenant" json:"tenant" yaml:"tenant"`
	Backoff        common.BackoffConfig `mapstructure:"backoff" json:"backoff" yaml:"backoff"`
	NoErrCodes     bool                 `mapstructure:"no_err_codes" json:"no_err_codes" yaml:"no_err_codes"`
}

func (*App) Normalize added in v0.1.63

func (a *App) Normalize() error

func (*App) ViewTenant

func (a *App) ViewTenant() string

type Auth

type Auth struct {
	Mode   AuthMode                    `mapstructure:"mode" json:"mode" yaml:"mode"`
	OAuth2 AuthOAuth2ClientCredentials `mapstructure:"oauth2" json:"oauth2" yaml:"oauth2"`
	Cookie AuthCookieSession           `mapstructure:"cookie" json:"cookie" yaml:"cookie"`
}

func (*Auth) Validate

func (c *Auth) Validate() error

type AuthCookieSession

type AuthCookieSession struct {
	BaseURL  string `mapstructure:"base_url" json:"base_url" yaml:"base_url"`
	Username string `mapstructure:"username" json:"username" yaml:"username"`
	Password string `mapstructure:"password" json:"password" yaml:"password"`
}

func (*AuthCookieSession) Validate

func (c *AuthCookieSession) Validate() error

type AuthMode

type AuthMode string
const (
	ModeNone   AuthMode = "none"
	ModeOAuth2 AuthMode = "oauth2"
	ModeCookie AuthMode = "cookie"
)

func (AuthMode) IsValid

func (m AuthMode) IsValid() bool

type AuthOAuth2ClientCredentials

type AuthOAuth2ClientCredentials struct {
	TokenURL     string `mapstructure:"token_url" json:"token_url" yaml:"token_url"`
	ClientID     string `mapstructure:"client_id" json:"client_id" yaml:"client_id"`
	ClientSecret string `mapstructure:"client_secret" json:"client_secret" yaml:"client_secret"`
	Scopes       Scopes `mapstructure:"scopes" json:"scopes" yaml:"scopes"`
}

func (*AuthOAuth2ClientCredentials) Scope

func (*AuthOAuth2ClientCredentials) Validate

func (a *AuthOAuth2ClientCredentials) Validate() error

type Config

type Config struct {
	Config string `mapstructure:"config" json:"config" yaml:"config"`

	App  App  `mapstructure:"app" json:"app" yaml:"app"`
	Auth Auth `mapstructure:"auth" json:"auth" yaml:"auth"`
	APIs APIs `mapstructure:"apis" json:"apis" yaml:"apis"`
	HTTP HTTP `mapstructure:"http" json:"http" yaml:"http"`
	Log  Log  `mapstructure:"log" json:"log" yaml:"log"`
}

func FromContext

func FromContext(ctx context.Context) (*Config, error)

func (*Config) Normalize

func (c *Config) Normalize() error

func (*Config) ToContext

func (c *Config) ToContext(ctx context.Context) context.Context

func (*Config) ToSanitizedYAML

func (c *Config) ToSanitizedYAML() (string, error)

func (*Config) ToTemplateYAML

func (c *Config) ToTemplateYAML() (string, error)

func (*Config) Validate

func (c *Config) Validate() error

type HTTP

type HTTP struct {
	Timeout string `mapstructure:"timeout" json:"timeout" yaml:"timeout"`
}

func (*HTTP) Validate

func (h *HTTP) Validate() error

type Log added in v0.1.61

type Log struct {
	Level           string `mapstructure:"level" json:"level" yaml:"level"`
	Format          string `mapstructure:"format" json:"format" yaml:"format"` // "text", "json" or "plain"
	WithSource      bool   `mapstructure:"with_source" json:"with_source" yaml:"with_source"`
	WithRequestBody bool   `mapstructure:"with_request_body" json:"with_request_body" yaml:"with_request_body"`
}

func (*Log) NewLogger added in v0.1.61

func (l *Log) NewLogger() *slog.Logger

func (*Log) Normalize added in v0.1.61

func (l *Log) Normalize()

func (*Log) Validate added in v0.1.61

func (l *Log) Validate() error

type Scopes

type Scopes map[string]string

Jump to

Keyboard shortcuts

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