configuration

package
Version: v42.0.0-...-56f38d9 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package configuration is in charge of the validation and extraction of all the configuration details from a configuration file.

Index

Constants

View Source
const (

	// DefaultValidRedirectURLs is a regex to be used to whitelist redirect URL for auth
	// If the F8_REDIRECT_VALID env var is not set then in Dev Mode all redirects allowed - *
	// In prod mode the following regex will be used by default:
	DefaultValidRedirectURLs = "^(https|http)://([^/]+[.])?(?i:openshift[.]io)(/.*)?$" // *.openshift.io/*

)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigurationData

type ConfigurationData struct {
	// contains filtered or unexported fields
}

ConfigurationData encapsulates the Viper configuration object which stores the configuration data in-memory.

func GetConfigurationData

func GetConfigurationData() (*ConfigurationData, error)

GetConfigurationData is a wrapper over NewConfigurationData which reads configuration file path from the environment variable.

func NewConfigurationData

func NewConfigurationData(configFilePath string) (*ConfigurationData, error)

NewConfigurationData creates a configuration reader object using a configurable configuration file path

func (*ConfigurationData) GetAuthDevModeURL

func (c *ConfigurationData) GetAuthDevModeURL() string

GetAuthDevModeURL returns Auth Service URL used by default in Dev mode

func (*ConfigurationData) GetAuthDomainPrefix

func (c *ConfigurationData) GetAuthDomainPrefix() string

GetAuthDomainPrefix returns the domain prefix which should be used in requests to the auth service

func (*ConfigurationData) GetAuthEndpointSpaces

func (c *ConfigurationData) GetAuthEndpointSpaces(req *http.Request) (string, error)

GetAuthEndpointSpaces returns the <auth>/api/spaces endpoint set via config file or environment variable. If nothing set then in Dev environment the defualt endopoint will be returned. In producion the endpoint will be calculated from the request by replacing the last domain/host name in the full host name. Example: api.service.domain.org -> auth.service.domain.org or api.domain.org -> auth.domain.org

func (*ConfigurationData) GetAuthNotApprovedRedirect

func (c *ConfigurationData) GetAuthNotApprovedRedirect() string

GetAuthNotApprovedRedirect returns the URL to redirect to if the user is not approved May return empty string which means an unauthorized error should be returned instead of redirecting the user

func (*ConfigurationData) GetCacheControlArea

func (c *ConfigurationData) GetCacheControlArea() string

GetCacheControlArea returns the value to set in the "Cache-Control" HTTP response header when returning a work item (or a list of).

func (*ConfigurationData) GetCacheControlAreas

func (c *ConfigurationData) GetCacheControlAreas() string

GetCacheControlAreas returns the value to set in the "Cache-Control" HTTP response header when returning a list of work items.

func (*ConfigurationData) GetCacheControlCollaborators

func (c *ConfigurationData) GetCacheControlCollaborators() string

GetCacheControlCollaborators returns the value to set in the "Cache-Control" HTTP response header when returning collaborators.

func (*ConfigurationData) GetCacheControlComment

func (c *ConfigurationData) GetCacheControlComment() string

GetCacheControlComment returns the value to set in the "Cache-Control" HTTP response header when returning a comment.

func (*ConfigurationData) GetCacheControlComments

func (c *ConfigurationData) GetCacheControlComments() string

GetCacheControlComments returns the value to set in the "Cache-Control" HTTP response header when returning a list of comments.

func (*ConfigurationData) GetCacheControlFilters

func (c *ConfigurationData) GetCacheControlFilters() string

GetCacheControlFilters returns the value to set in the "Cache-Control" HTTP response header when returning comments.

func (*ConfigurationData) GetCacheControlIteration

func (c *ConfigurationData) GetCacheControlIteration() string

GetCacheControlIteration returns the value to set in the "Cache-Control" HTTP response header when returning an iteration.

func (*ConfigurationData) GetCacheControlIterations

func (c *ConfigurationData) GetCacheControlIterations() string

GetCacheControlIterations returns the value to set in the "Cache-Control" HTTP response header when returning a list of iterations.

func (*ConfigurationData) GetCacheControlSpace

func (c *ConfigurationData) GetCacheControlSpace() string

GetCacheControlSpace returns the value to set in the "Cache-Control" HTTP response header when returning a space.

func (*ConfigurationData) GetCacheControlSpaces

func (c *ConfigurationData) GetCacheControlSpaces() string

GetCacheControlSpaces returns the value to set in the "Cache-Control" HTTP response header when returning a list of spaces.

func (*ConfigurationData) GetCacheControlUser

func (c *ConfigurationData) GetCacheControlUser() string

GetCacheControlUser returns the value to set in the "Cache-Control" HTTP response header when data for the current user.

func (*ConfigurationData) GetCacheControlUsers

func (c *ConfigurationData) GetCacheControlUsers() string

GetCacheControlUsers returns the value to set in the "Cache-Control" HTTP response header when returning users.

func (*ConfigurationData) GetCacheControlWorkItem

func (c *ConfigurationData) GetCacheControlWorkItem() string

GetCacheControlWorkItem returns the value to set in the "Cache-Control" HTTP response header when returning a work item.

func (c *ConfigurationData) GetCacheControlWorkItemLink() string

GetCacheControlWorkItemLink returns the value to set in the "Cache-Control" HTTP response header when returning a work item.

func (*ConfigurationData) GetCacheControlWorkItemLinkType

func (c *ConfigurationData) GetCacheControlWorkItemLinkType() string

GetCacheControlWorkItemLinkType returns the value to set in the "Cache-Control" HTTP response header when returning a work item type.

func (*ConfigurationData) GetCacheControlWorkItemLinkTypes

func (c *ConfigurationData) GetCacheControlWorkItemLinkTypes() string

GetCacheControlWorkItemLinkTypes returns the value to set in the "Cache-Control" HTTP response header when returning a list of work item types.

func (c *ConfigurationData) GetCacheControlWorkItemLinks() string

GetCacheControlWorkItemLinks returns the value to set in the "Cache-Control" HTTP response header when returning a list of work item links.

func (*ConfigurationData) GetCacheControlWorkItemType

func (c *ConfigurationData) GetCacheControlWorkItemType() string

GetCacheControlWorkItemType returns the value to set in the "Cache-Control" HTTP response header when returning a work item type.

func (*ConfigurationData) GetCacheControlWorkItemTypes

func (c *ConfigurationData) GetCacheControlWorkItemTypes() string

GetCacheControlWorkItemTypes returns the value to set in the "Cache-Control" HTTP response header when returning a list of work item types.

func (*ConfigurationData) GetCacheControlWorkItems

func (c *ConfigurationData) GetCacheControlWorkItems() string

GetCacheControlWorkItems returns the value to set in the "Cache-Control" HTTP response header when returning a list of work items.

func (*ConfigurationData) GetCheStarterURL

func (c *ConfigurationData) GetCheStarterURL() string

GetCheStarterURL returns the URL for the Che Starter service used by codespaces to initiate code editing

func (*ConfigurationData) GetDefaultConfigurationFile

func (c *ConfigurationData) GetDefaultConfigurationFile() string

GetDefaultConfigurationFile returns the default configuration file.

func (*ConfigurationData) GetFeatureWorkitemRemote

func (c *ConfigurationData) GetFeatureWorkitemRemote() bool

GetFeatureWorkitemRemote returns true if remote Work Item feaute is enabled

func (*ConfigurationData) GetGithubAuthToken

func (c *ConfigurationData) GetGithubAuthToken() string

GetGithubAuthToken returns the actual Github OAuth Access Token

func (*ConfigurationData) GetHTTPAddress

func (c *ConfigurationData) GetHTTPAddress() string

GetHTTPAddress returns the HTTP address (as set via default, config file, or environment variable) that the wit server binds to (e.g. "0.0.0.0:8080")

func (*ConfigurationData) GetHeaderMaxLength

func (c *ConfigurationData) GetHeaderMaxLength() int64

GetHeaderMaxLength returns the max length of HTTP headers allowed in the system For example it can be used to limit the size of bearer tokens returned by the api service

func (*ConfigurationData) GetKeycloakAccountEndpoint

func (c *ConfigurationData) GetKeycloakAccountEndpoint(req *http.Request) (string, error)

GetKeycloakAccountEndpoint returns the API URL for Read and Update on Keycloak User Accounts.

func (*ConfigurationData) GetKeycloakClientID

func (c *ConfigurationData) GetKeycloakClientID() string

GetKeycloakClientID returns the keycloak client ID (as set via config file or environment variable) that is used to make authorized Keycloak API Calls.

func (*ConfigurationData) GetKeycloakDevModeURL

func (c *ConfigurationData) GetKeycloakDevModeURL() string

GetKeycloakDevModeURL returns Keycloak URL used by default in Dev mode

func (*ConfigurationData) GetKeycloakDomainPrefix

func (c *ConfigurationData) GetKeycloakDomainPrefix() string

GetKeycloakDomainPrefix returns the domain prefix which should be used in all Keycloak requests

func (*ConfigurationData) GetKeycloakEndpointAdmin

func (c *ConfigurationData) GetKeycloakEndpointAdmin(req *http.Request) (string, error)

GetKeycloakEndpointAdmin returns the <keycloak>/realms/admin/<realm> endpoint set via config file or environment variable. If nothing set then in Dev environment the defualt endopoint will be returned. In producion the endpoint will be calculated from the request by replacing the last domain/host name in the full host name. Example: api.service.domain.org -> sso.service.domain.org or api.domain.org -> sso.domain.org

func (*ConfigurationData) GetKeycloakEndpointAuth

func (c *ConfigurationData) GetKeycloakEndpointAuth(req *http.Request) (string, error)

GetKeycloakEndpointAuth returns the keycloak auth endpoint set via config file or environment variable. If nothing set then in Dev environment the defualt endopoint will be returned. In producion the endpoint will be calculated from the request by replacing the last domain/host name in the full host name. Example: api.service.domain.org -> sso.service.domain.org or api.domain.org -> sso.domain.org

func (*ConfigurationData) GetKeycloakEndpointAuthzResourceset

func (c *ConfigurationData) GetKeycloakEndpointAuthzResourceset(req *http.Request) (string, error)

GetKeycloakEndpointAuthzResourceset returns the <keycloak>/realms/<realm>/authz/protection/resource_set endpoint set via config file or environment variable. If nothing set then in Dev environment the defualt endopoint will be returned. In producion the endpoint will be calculated from the request by replacing the last domain/host name in the full host name. Example: api.service.domain.org -> sso.service.domain.org or api.domain.org -> sso.domain.org

func (*ConfigurationData) GetKeycloakEndpointBroker

func (c *ConfigurationData) GetKeycloakEndpointBroker(req *http.Request) (string, error)

GetKeycloakEndpointBroker returns the <keycloak>/realms/<realm>/authz/entitlement/<clientID> endpoint set via config file or environment variable. If nothing set then in Dev environment the defualt endopoint will be returned. In producion the endpoint will be calculated from the request by replacing the last domain/host name in the full host name. Example: api.service.domain.org -> sso.service.domain.org or api.domain.org -> sso.domain.org

func (*ConfigurationData) GetKeycloakEndpointClients

func (c *ConfigurationData) GetKeycloakEndpointClients(req *http.Request) (string, error)

GetKeycloakEndpointClients returns the <keycloak>/admin/realms/<realm>/clients endpoint set via config file or environment variable. If nothing set then in Dev environment the defualt endopoint will be returned. In producion the endpoint will be calculated from the request by replacing the last domain/host name in the full host name. Example: api.service.domain.org -> sso.service.domain.org or api.domain.org -> sso.domain.org

func (*ConfigurationData) GetKeycloakEndpointEntitlement

func (c *ConfigurationData) GetKeycloakEndpointEntitlement(req *http.Request) (string, error)

GetKeycloakEndpointEntitlement returns the <keycloak>/realms/<realm>/authz/entitlement/<clientID> endpoint set via config file or environment variable. If nothing set then in Dev environment the defualt endopoint will be returned. In producion the endpoint will be calculated from the request by replacing the last domain/host name in the full host name. Example: api.service.domain.org -> sso.service.domain.org or api.domain.org -> sso.domain.org

func (*ConfigurationData) GetKeycloakEndpointLogout

func (c *ConfigurationData) GetKeycloakEndpointLogout(req *http.Request) (string, error)

GetKeycloakEndpointLogout returns the keycloak logout endpoint set via config file or environment variable. If nothing set then in Dev environment the defualt endopoint will be returned. In producion the endpoint will be calculated from the request by replacing the last domain/host name in the full host name. Example: api.service.domain.org -> sso.service.domain.org or api.domain.org -> sso.domain.org

func (*ConfigurationData) GetKeycloakEndpointToken

func (c *ConfigurationData) GetKeycloakEndpointToken(req *http.Request) (string, error)

GetKeycloakEndpointToken returns the keycloak token endpoint set via config file or environment variable. If nothing set then in Dev environment the defualt endopoint will be returned. In producion the endpoint will be calculated from the request by replacing the last domain/host name in the full host name. Example: api.service.domain.org -> sso.service.domain.org or api.domain.org -> sso.domain.org

func (*ConfigurationData) GetKeycloakEndpointUserInfo

func (c *ConfigurationData) GetKeycloakEndpointUserInfo(req *http.Request) (string, error)

GetKeycloakEndpointUserInfo returns the keycloak userinfo endpoint set via config file or environment variable. If nothing set then in Dev environment the defualt endopoint will be returned. In producion the endpoint will be calculated from the request by replacing the last domain/host name in the full host name. Example: api.service.domain.org -> sso.service.domain.org or api.domain.org -> sso.domain.org

func (*ConfigurationData) GetKeycloakRealm

func (c *ConfigurationData) GetKeycloakRealm() string

GetKeycloakRealm returns the keycloak realm name

func (*ConfigurationData) GetKeycloakSecret

func (c *ConfigurationData) GetKeycloakSecret() string

GetKeycloakSecret returns the keycloak client secret (as set via config file or environment variable) that is used to make authorized Keycloak API Calls.

func (*ConfigurationData) GetKeycloakTestUser2Name

func (c *ConfigurationData) GetKeycloakTestUser2Name() string

GetKeycloakTestUser2Name returns the keycloak test user name used to obtain a test token (as set via config file or environment variable)

func (*ConfigurationData) GetKeycloakTestUser2Secret

func (c *ConfigurationData) GetKeycloakTestUser2Secret() string

GetKeycloakTestUser2Secret returns the keycloak test user password used to obtain a test token (as set via config file or environment variable)

func (*ConfigurationData) GetKeycloakTestUserName

func (c *ConfigurationData) GetKeycloakTestUserName() string

GetKeycloakTestUserName returns the keycloak test user name used to obtain a test token (as set via config file or environment variable)

func (*ConfigurationData) GetKeycloakTestUserSecret

func (c *ConfigurationData) GetKeycloakTestUserSecret() string

GetKeycloakTestUserSecret returns the keycloak test user password used to obtain a test token (as set via config file or environment variable)

func (*ConfigurationData) GetLogLevel

func (c *ConfigurationData) GetLogLevel() string

GetLogLevel returns the loggging level (as set via config file or environment variable)

func (*ConfigurationData) GetNotificationServiceURL

func (c *ConfigurationData) GetNotificationServiceURL() string

GetNotificationServiceURL returns the URL for the Notification service used for event notification

func (*ConfigurationData) GetOpenshiftTenantMasterURL

func (c *ConfigurationData) GetOpenshiftTenantMasterURL() string

GetOpenshiftTenantMasterURL returns the URL for the openshift cluster where the tenant services are running

func (*ConfigurationData) GetPopulateCommonTypes

func (c *ConfigurationData) GetPopulateCommonTypes() bool

GetPopulateCommonTypes returns true if the (as set via default, config file, or environment variable) the common work item types such as bug or feature shall be created.

func (*ConfigurationData) GetPostgresConfigString

func (c *ConfigurationData) GetPostgresConfigString() string

GetPostgresConfigString returns a ready to use string for usage in sql.Open()

func (*ConfigurationData) GetPostgresConnectionMaxIdle

func (c *ConfigurationData) GetPostgresConnectionMaxIdle() int

GetPostgresConnectionMaxIdle returns the number of connections that should be keept alive in the database connection pool at any given time. -1 represents no restrictions/default behavior

func (*ConfigurationData) GetPostgresConnectionMaxOpen

func (c *ConfigurationData) GetPostgresConnectionMaxOpen() int

GetPostgresConnectionMaxOpen returns the max number of open connections that should be open in the database connection pool. -1 represents no restrictions/default behavior

func (*ConfigurationData) GetPostgresConnectionRetrySleep

func (c *ConfigurationData) GetPostgresConnectionRetrySleep() time.Duration

GetPostgresConnectionRetrySleep returns the number of seconds (as set via default, config file, or environment variable) to wait before trying to connect again

func (*ConfigurationData) GetPostgresConnectionTimeout

func (c *ConfigurationData) GetPostgresConnectionTimeout() int64

GetPostgresConnectionTimeout returns the postgres connection timeout as set via default, config file, or environment variable

func (*ConfigurationData) GetPostgresDatabase

func (c *ConfigurationData) GetPostgresDatabase() string

GetPostgresDatabase returns the postgres database as set via default, config file, or environment variable

func (*ConfigurationData) GetPostgresHost

func (c *ConfigurationData) GetPostgresHost() string

GetPostgresHost returns the postgres host as set via default, config file, or environment variable

func (*ConfigurationData) GetPostgresPassword

func (c *ConfigurationData) GetPostgresPassword() string

GetPostgresPassword returns the postgres password as set via default, config file, or environment variable

func (*ConfigurationData) GetPostgresPort

func (c *ConfigurationData) GetPostgresPort() int64

GetPostgresPort returns the postgres port as set via default, config file, or environment variable

func (*ConfigurationData) GetPostgresSSLMode

func (c *ConfigurationData) GetPostgresSSLMode() string

GetPostgresSSLMode returns the postgres sslmode as set via default, config file, or environment variable

func (*ConfigurationData) GetPostgresTransactionTimeout

func (c *ConfigurationData) GetPostgresTransactionTimeout() time.Duration

GetPostgresTransactionTimeout returns the number of minutes to timeout a transaction

func (*ConfigurationData) GetPostgresUser

func (c *ConfigurationData) GetPostgresUser() string

GetPostgresUser returns the postgres user as set via default, config file, or environment variable

func (*ConfigurationData) GetTenantServiceURL

func (c *ConfigurationData) GetTenantServiceURL() string

GetTenantServiceURL returns the URL for the Tenant service used by login to initialize OSO tenant space

func (*ConfigurationData) GetTokenPrivateKey

func (c *ConfigurationData) GetTokenPrivateKey() []byte

GetTokenPrivateKey returns the private key (as set via config file or environment variable) that is used to sign the authentication token.

func (*ConfigurationData) GetTokenPublicKey

func (c *ConfigurationData) GetTokenPublicKey() []byte

GetTokenPublicKey returns the public key (as set via config file or environment variable) that is used to decrypt the authentication token.

func (*ConfigurationData) GetValidRedirectURLs

func (c *ConfigurationData) GetValidRedirectURLs(req *http.Request) (string, error)

GetValidRedirectURLs returns the RegEx of valid redirect URLs for auth requests If the F8_REDIRECT_VALID env var is not set then in Dev Mode all redirects allowed - * In prod mode the default regex will be returned

func (*ConfigurationData) IsAuthorizationEnabled

func (c *ConfigurationData) IsAuthorizationEnabled() bool

IsAuthorizationEnabled returns true if space authorization enabled By default athorization is disabled in Developer Mode only (if F8_AUTHZ_ENABLED us not set) Set F8_AUTHZ_ENABLED env var to explictly disable or enable authorization regardless of Developer Mode settings

func (*ConfigurationData) IsLogJSON

func (c *ConfigurationData) IsLogJSON() bool

IsLogJSON returns if we should log json format (as set via config file or environment variable)

func (*ConfigurationData) IsPostgresDeveloperModeEnabled

func (c *ConfigurationData) IsPostgresDeveloperModeEnabled() bool

IsPostgresDeveloperModeEnabled returns if development related features (as set via default, config file, or environment variable), e.g. token generation endpoint are enabled

func (*ConfigurationData) String

func (c *ConfigurationData) String() string

String returns the current configuration as a string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL