Documentation ¶
Index ¶
- Constants
- func AuthenticationHandler(next http.Handler) http.Handler
- func Marshal(conf *Config) (yamlString string, err error)
- func SaveToFile(filename string, conf *Config) (err error)
- func Set(conf *Config)
- func ValidateToken(tokenString string) error
- type Config
- type ExternalServices
- type GrafanaConfig
- type IstioConfig
- type JaegerConfig
- type Server
- type Token
- type TokenClaim
- type TokenGenerated
Constants ¶
const ( EnvIdentityCertFile = "IDENTITY_CERT_FILE" EnvIdentityPrivateKeyFile = "IDENTITY_PRIVATE_KEY_FILE" EnvPrometheusServiceURL = "PROMETHEUS_SERVICE_URL" EnvInCluster = "IN_CLUSTER" EnvIstioIdentityDomain = "ISTIO_IDENTITY_DOMAIN" EnvIstioSidecarAnnotation = "ISTIO_SIDECAR_ANNOTATION" EnvIstioUrlServiceVersion = "ISTIO_URL_SERVICE_VERSION" EnvServerAddress = "SERVER_ADDRESS" EnvServerPort = "SERVER_PORT" EnvServerCredentialsUsername = "SERVER_CREDENTIALS_USERNAME" EnvServerCredentialsPassword = "SERVER_CREDENTIALS_PASSWORD" EnvServerStaticContentRootDirectory = "SERVER_STATIC_CONTENT_ROOT_DIRECTORY" EnvServerCORSAllowAll = "SERVER_CORS_ALLOW_ALL" EnvGrafanaDisplayLink = "GRAFANA_DISPLAY_LINK" EnvGrafanaURL = "GRAFANA_URL" EnvGrafanaServiceNamespace = "GRAFANA_SERVICE_NAMESPACE" EnvGrafanaService = "GRAFANA_SERVICE" EnvGrafanaDashboard = "GRAFANA_DASHBOARD" EnvGrafanaVarServiceSource = "GRAFANA_VAR_SERVICE_SOURCE" EnvGrafanaVarServiceDest = "GRAFANA_VAR_SERVICE_DEST" EnvJaegerURL = "JAEGER_URL" EnvJaegerServiceNamespace = "JAEGER_SERVICE_NAMESPACE" EnvJaegerService = "JAEGER_SERVICE" EnvServiceFilterLabelName = "SERVICE_FILTER_LABEL_NAME" EnvVersionFilterLabelName = "VERSION_FILTER_LABEL_NAME" EnvTokenSecret = "TOKEN_SECRET" EnvTokenExpirationAt = "TOKEN_EXPIRATION_AT" IstioVersionSupported = ">= 0.8" )
Environment vars can define some default values. NOTE: If you add a new variable, don't forget to update README.adoc
Variables ¶
This section is empty.
Functions ¶
func SaveToFile ¶
SaveToFile converts the Config object and stores its YAML string into the given file, overwriting any data that is in the file.
func ValidateToken ¶
Types ¶
type Config ¶
type Config struct { Identity security.Identity `yaml:",omitempty"` Server Server `yaml:",omitempty"` InCluster bool `yaml:"in_cluster,omitempty"` ServiceFilterLabelName string `yaml:"service_filter_label_name,omitempty"` VersionFilterLabelName string `yaml:"version_filter_label_name,omitempty"` ExternalServices ExternalServices `yaml:"external_services,omitempty"` Token Token `yaml:"token,omitempty"` }
Config defines full YAML configuration.
func LoadFromFile ¶
LoadFromFile reads the YAML from the given file, parses the content, and returns its Config object representation.
type ExternalServices ¶
type ExternalServices struct { Istio IstioConfig `yaml:"istio,omitempty"` PrometheusServiceURL string `yaml:"prometheus_service_url,omitempty"` Grafana GrafanaConfig `yaml:"grafana,omitempty"` Jaeger JaegerConfig `yaml:"jaeger,omitempty"` }
type GrafanaConfig ¶
type GrafanaConfig struct { DisplayLink bool `yaml:"display_link"` URL string `yaml:"url"` ServiceNamespace string `yaml:"service_namespace"` Service string `yaml:"service"` Dashboard string `yaml:"dashboard"` VarServiceSource string `yaml:"var_service_source"` VarServiceDest string `yaml:"var_service_dest"` }
GrafanaConfig describes configuration used for Grafana links
type IstioConfig ¶
type IstioConfig struct { UrlServiceVersion string `yaml:"url_service_version"` IstioIdentityDomain string `yaml:"istio_identity_domain,omitempty"` IstioSidecarAnnotation string `yaml:"istio_sidecar_annotation,omitempty"` }
IstioConfig describes configuration used for istio links
type JaegerConfig ¶
type JaegerConfig struct { URL string `yaml:"url"` ServiceNamespace string `yaml:"service_namespace"` Service string `yaml:"service"` }
JaegerConfig describes configuration used for jaeger links
type Server ¶
type Server struct { Address string `yaml:",omitempty"` Port int `yaml:",omitempty"` Credentials security.Credentials `yaml:",omitempty"` StaticContentRootDirectory string `yaml:"static_content_root_directory,omitempty"` CORSAllowAll bool `yaml:"cors_allow_all,omitempty"` }
Server configuration
type TokenClaim ¶
type TokenClaim struct { User string `json:"username"` jwt.StandardClaims }
Structured version of Claims Section, as referenced at https://tools.ietf.org/html/rfc7519#section-4.1 See examples for how to use this with your own claim types
type TokenGenerated ¶
func GenerateToken ¶
func GenerateToken(username string) (TokenGenerated, error)
Generate the token with a Expiraton of <ExpiresAt> seconds