config

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 16 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TimeNow = func() time.Time {
	return time.Now()
}

to replace time when testing

Functions

This section is empty.

Types

type Access

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

func NewAccess

func NewAccess(config Config) *Access

func (*Access) Ensure

func (this *Access) Ensure() (token Impersonate, err error)

type Config

type Config struct {
	ServerPort                   string   `json:"server_port"`
	PrometheusPort               string   `json:"prometheus_port"`
	AuthExpirationTimeBuffer     float64  `json:"auth_expiration_time_buffer"`
	AuthEndpoint                 string   `json:"auth_endpoint"`
	AuthClientId                 string   `json:"auth_client_id"`
	AuthClientSecret             string   `json:"auth_client_secret"`
	PermissionsSearchUrl         string   `json:"permissions_search_url"`
	DeviceRepositoryUrl          string   `json:"device_repository_url"`
	ConceptRepoRefreshInterval   int64    `json:"concept_repo_refresh_interval"`
	LogLevel                     string   `json:"log_level"`
	ConverterUrl                 string   `json:"converter_url"`
	ReturnUnknownPathAsNull      bool     `json:"return_unknown_path_as_null"`
	Debug                        bool     `json:"debug"`
	KafkaUrl                     string   `json:"kafka_url"`                       //optional, used for cache invalidation
	CacheInvalidationKafkaTopics []string `json:"cache_invalidation_kafka_topics"` //optional, used for cache invalidation
}

func Load

func Load(location string) (config Config, err error)

loads config from json in location and used environment variables (e.g ZookeeperUrl --> ZOOKEEPER_URL)

type Impersonate

type Impersonate string

func (Impersonate) Get

func (this Impersonate) Get(url string) (resp *http.Response, err error)

func (Impersonate) GetJSON

func (this Impersonate) GetJSON(url string, result interface{}) (err error)

func (Impersonate) Post

func (this Impersonate) Post(url string, contentType string, body io.Reader) (resp *http.Response, err error)

func (Impersonate) PostJSON

func (this Impersonate) PostJSON(url string, body interface{}, result interface{}) (err error)

type OpenidToken

type OpenidToken struct {
	AccessToken      string    `json:"access_token"`
	ExpiresIn        float64   `json:"expires_in"`
	RefreshExpiresIn float64   `json:"refresh_expires_in"`
	RefreshToken     string    `json:"refresh_token"`
	TokenType        string    `json:"token_type"`
	RequestTime      time.Time `json:"-"`
}

Jump to

Keyboard shortcuts

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