conf

package
v0.0.0-...-f5e1f6b Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLogger

func GetLogger(env string, level zapcore.Level, serviceName string) *zap.SugaredLogger

func NewLogger

func NewLogger(env *Env) *zap.SugaredLogger

func NewStatsd

func NewStatsd(lc fx.Lifecycle, env *Env) (statsd.ClientInterface, error)

Types

type AuthConfig

type AuthConfig struct {
	WellKnown     string
	Audience      string
	AudienceAuth0 string
	Issuer        string
	IssuerAuth0   string
	Middleware    string
}

type ColumnMapping

type ColumnMapping struct {
	FieldName         string           `json:"fieldName" yaml:"fieldName"`
	PropertyName      string           `json:"propertyName" yaml:"propertyName"`
	IsIdColumn        bool             `json:"isIdColumn" yaml:"isIdColumn"`
	IsReference       bool             `json:"isReference" yaml:"isReference"`
	IsEntity          bool             `json:"isEntity" yaml:"isEntity"`
	ReferenceTemplate string           `json:"referenceTemplate" yaml:"referenceTemplate"`
	IgnoreColumn      bool             `json:"ignoreColumn" yaml:"ignoreColumn"`
	IdTemplate        string           `json:"idTemplate" yaml:"idTemplate"`
	ColumnMappings    []*ColumnMapping `json:"columnMappings" yaml:"columnMappings"`
}

type ConfigurationManager

type ConfigurationManager struct {
	Datalayer *Datalayer

	State          State
	TokenProviders *TokenProviders
	// contains filtered or unexported fields
}

func NewConfigurationManager

func NewConfigurationManager(lc fx.Lifecycle, env *Env, providers *TokenProviders) *ConfigurationManager

func (*ConfigurationManager) Init

func (conf *ConfigurationManager) Init()

type Datalayer

type Datalayer struct {
	Id             string          `json:"id" yaml:"id"`
	DatabaseServer string          `json:"databaseServer" yaml:"databaseServer"`
	BaseUri        string          `json:"baseUri" yaml:"baseUri"`
	Database       string          `json:"database" yaml:"database"`
	Port           string          `json:"port" yaml:"port"`
	Schema         string          `json:"schema" yaml:"schema"`
	BaseNameSpace  string          `json:"baseNameSpace" yaml:"baseNameSpace"`
	User           string          `json:"user" yaml:"user"`
	Password       string          `json:"password" yaml:"password"`
	TableMappings  []*TableMapping `json:"tableMappings" yaml:"tableMappings"`
	PostMappings   []*PostMapping  `json:"postMappings" yaml:"postMappings"`
}

func (*Datalayer) GetUrl

func (layer *Datalayer) GetUrl(postMapping *PostMapping, tableMapping *TableMapping) *url.URL

type Env

type Env struct {
	Logger          *zap.SugaredLogger
	Env             string
	LogLevel        string `koanf:"server.log.level"`
	Port            string `koanf:"server.port"`
	ServiceName     string `koanf:"server.service.name"`
	AgentHost       string `koanf:"dd.agent.host"`
	ConfigLocation  string
	RefreshInterval string
	Jwt             JwtConfig `koanf:"jwt"`
	User            User
	Auth            AuthConfig
}

func NewEnv

func NewEnv() (*Env, error)

type FieldMapping

type FieldMapping struct {
	FieldName        string `json:"fieldName" yaml:"fieldName"`
	ToPostgresField  string `json:"toPostgresField" yaml:"toPostgresField"`
	SortOrder        int    `json:"order" yaml:"sortOrder"`
	Type             string `json:"type" yaml:"type"`
	ResolveNamespace bool   `json:"resolveNamespace" yaml:"resolveNamespace"`
}

type JWTConfig

type JWTConfig struct {
	ClientId     string `json:"client_id"`
	ClientSecret string `json:"client_secret"`
	Audience     string `json:"audience"`
	GrantType    string `json:"grant_type"`
	// contains filtered or unexported fields
}

JWTConfig contains the auth configuration

func NewJWTConfig

func NewJWTConfig(env *Env) *JWTConfig

NewJWTConfig creates a new JWT Auth Config struct, populated with the values from Viper.

func (*JWTConfig) Token

func (jc *JWTConfig) Token() (string, error)

Token returns a valid token, or an error caused when getting one Successive calls to this will return cached values, where the cache validity equals the token validity. Experience-wise, this can lead to race conditions when the caller asks for a valid token that is about to run out, and then it runs out before it can be used.

type JWTResponse

type JWTResponse struct {
	AccessToken string `json:"access_token"`
	Scope       string `json:"scope"`
	ExpiresIn   int64  `json:"expires_in"`
	TokenType   string `json:"token_type"`
}

type JwtConfig

type JwtConfig struct {
	ClientId     string `koanf:"client_id"`
	ClientSecret string `koanf:"client_secret"`
	Audience     string `koanf:"audience"`
	GrantType    string `koanf:"grant_type"`
	Endpoint     string `koanf:"endpoint"`
}

type PostMapping

type PostMapping struct {
	DatasetName   string          `json:"datasetName" yaml:"datasetName"`
	TableName     string          `json:"tableName" yaml:"tableName"`
	Query         string          `json:"query" yaml:"query"`
	Config        *TableConfig    `json:"config" yaml:"config"`
	FieldMappings []*FieldMapping `json:"fieldMappings" yaml:"fieldMappings"`
	IdColumn      string          `json:"idColumn" yaml:"idColumn"`
}

type State

type State struct {
	Timestamp int64
	Digest    [16]byte
}

type TableConfig

type TableConfig struct {
	DatabaseServer *string         `json:"databaseServer" yaml:"databaseServer"`
	Database       *string         `json:"database" yaml:"database"`
	Port           *string         `json:"port" yaml:"port"`
	Schema         *string         `json:"schema" yaml:"schema"`
	User           *VariableGetter `json:"user" yaml:"user"`
	Password       *VariableGetter `json:"password" yaml:"password"`
}

type TableMapping

type TableMapping struct {
	TableName           string           `json:"tableName" yaml:"tableName"`
	NameSpace           string           `json:"nameSpace" yaml:"nameSpace"`
	CustomQuery         string           `json:"query" yaml:"customQuery"`
	CDCEnabled          bool             `json:"cdcEnabled" yaml:"cdcEnabled"`
	EntityIdConstructor string           `json:"entityIdConstructor" yaml:"entityIdConstructor"`
	Types               []string         `json:"types" yaml:"types"`
	ColumnMappings      []*ColumnMapping `json:"columnMappings" yaml:"columnMappings"`
	Config              *TableConfig     `json:"config" yaml:"config"`
	Columns             map[string]*ColumnMapping
}

type TokenProvider

type TokenProvider interface {
	Token() (string, error)
}

type TokenProviders

type TokenProviders struct {
	Providers map[string]interface{}
}

func NewTokenProviders

func NewTokenProviders(env *Env) *TokenProviders

NewTokenProviders provides a map of token providers, keyed on the name of the token provider struct as lower_case.

func NoOpTokenProviders

func NoOpTokenProviders() *TokenProviders

type User

type User struct {
	UserName string
	Password string
}

type VariableGetter

type VariableGetter struct {
	Type string `json:"type" yaml:"type"`
	Key  string `json:"key" yaml:"key"`
}

func (*VariableGetter) GetValue

func (v *VariableGetter) GetValue() string

Jump to

Keyboard shortcuts

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