Documentation
¶
Index ¶
Constants ¶
View Source
const ( APIPermissionsFilePathEnvKey = "API_PERMISSIONS_FILE_PATH" TargetServiceOASPathEnvKey = "TARGET_SERVICE_OAS_PATH" StandaloneEnvKey = "STANDALONE" TargetServiceHostEnvKey = "TARGET_SERVICE_HOST" BindingsCrudServiceURL = "BINDINGS_CRUD_SERVICE_URL" TraceLogLevel = "trace" )
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: "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 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 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
Click to show internal directories.
Click to hide internal directories.