config

package
v1.12.8 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EnvVariablesConfig = []configlib.EnvConfig{
	{
		Key:          "LOG_LEVEL",
		Variable:     "LogLevel",
		DefaultValue: "info",
	},
	{
		Key:          "HTTP_PORT",
		Variable:     "HTTPPort",
		DefaultValue: "8080",
	},
	{
		Key:          "SERVICE_VERSION",
		Variable:     "ServiceVersion",
		DefaultValue: "latest",
	},
	{
		Key:      targetServiceHostEnvKey,
		Variable: "TargetServiceHost",
	},
	{
		Key:      targetServiceOASPathEnvKey,
		Variable: "TargetServiceOASPath",
	},
	{
		Key:      "OPA_MODULES_DIRECTORY",
		Variable: "OPAModulesDirectory",
		Required: true,
	},
	{
		Key:      apiPermissionsFilePathEnvKey,
		Variable: "APIPermissionsFilePath",
	},
	{
		Key:          "USER_PROPERTIES_HEADER_KEY",
		Variable:     "UserPropertiesHeader",
		DefaultValue: "miauserproperties",
	},
	{
		Key:          "USER_GROUPS_HEADER_KEY",
		Variable:     "UserGroupsHeader",
		DefaultValue: "miausergroups",
	},
	{
		Key:          "USER_ID_HEADER_KEY",
		Variable:     "UserIdHeader",
		DefaultValue: "miauserid",
	},
	{
		Key:          "CLIENT_TYPE_HEADER_KEY",
		Variable:     "ClientTypeHeader",
		DefaultValue: "Client-Type",
	},
	{
		Key:          "DELAY_SHUTDOWN_SECONDS",
		Variable:     "DelayShutdownSeconds",
		DefaultValue: "10",
	},
	{
		Key:      "MONGODB_URL",
		Variable: "MongoDBUrl",
	},
	{
		Key:          "MONGODB_CONNECTION_MAX_IDLE_TIME_MS",
		Variable:     "MongoDBConnectionMaxIdleTimeMs",
		DefaultValue: "1000",
	},
	{
		Key:      "BINDINGS_COLLECTION_NAME",
		Variable: "BindingsCollectionName",
	},
	{
		Key:      "ROLES_COLLECTION_NAME",
		Variable: "RolesCollectionName",
	},
	{
		Key:      standaloneEnvKey,
		Variable: "Standalone",
	},
	{
		Key:          "PATH_PREFIX_STANDALONE",
		Variable:     "PathPrefixStandalone",
		DefaultValue: "/eval",
	},
	{
		Key:      bindingsCrudServiceURL,
		Variable: "BindingsCrudServiceURL",
	},
	{
		Key:          "ADDITIONAL_HEADERS_TO_PROXY",
		Variable:     "AdditionalHeadersToProxy",
		DefaultValue: "miauserid",
	},
	{
		Key:          "EXPOSE_METRICS",
		Variable:     "ExposeMetrics",
		DefaultValue: "true",
	},
}

Functions

func RequestMiddlewareEnvironments

func RequestMiddlewareEnvironments(env EnvironmentVariables) mux.MiddlewareFunc

RequestMiddlewareEnvironments is a gorilla/mux middleware used to inject env variables into requests.

Types

type EnvKey

type EnvKey struct{}

type EnvironmentVariables

type EnvironmentVariables struct {
	LogLevel                       string
	HTTPPort                       string
	ServiceVersion                 string
	TargetServiceHost              string
	TargetServiceOASPath           string
	OPAModulesDirectory            string
	APIPermissionsFilePath         string
	UserPropertiesHeader           string
	UserGroupsHeader               string
	UserIdHeader                   string
	ClientTypeHeader               string
	BindingsCrudServiceURL         string
	MongoDBUrl                     string
	MongoDBConnectionMaxIdleTimeMs int
	RolesCollectionName            string
	BindingsCollectionName         string
	PathPrefixStandalone           string
	DelayShutdownSeconds           int
	Standalone                     bool
	AdditionalHeadersToProxy       string
	ExposeMetrics                  bool
}

EnvironmentVariables struct with the mapping of desired environment variables.

func GetEnv

func GetEnv(requestContext context.Context) (EnvironmentVariables, error)

GetEnv can be used by a request handler to get environment variables from its context.

func GetEnvOrDie

func GetEnvOrDie() EnvironmentVariables

func (EnvironmentVariables) GetAdditionalHeadersToProxy added in v1.5.2

func (env EnvironmentVariables) GetAdditionalHeadersToProxy() []string

func (EnvironmentVariables) IsTraceLogLevel added in v1.9.0

func (env EnvironmentVariables) IsTraceLogLevel() bool

Jump to

Keyboard shortcuts

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