config

package
v0.0.0-...-0fc66b4 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultConfigPath = "config/dev.toml"
	DefaultEnvPath    = "config/.env"
	Filename          = "dev.toml"
	Extension         = ".toml"

	EnvironmentDev  Environment = "dev"
	EnvironmentTest Environment = "test"
	EnvironmentProd Environment = "prod"

	ConfigPath EnvironmentVariable = "CONFIG_PATH"
	DBPassword EnvironmentVariable = "DB_PASSWORD"
)
View Source
const (
	ServiceName    = "ssi-service"
	ServiceVersion = "0.0.3"
	APIVersion     = "v1"
)

Variables

This section is empty.

Functions

func Description

func Description() string

func GetAPIBase

func GetAPIBase() string

func GetServicePath

func GetServicePath(service framework.Type) string

func GetStatusBase

func GetStatusBase() string

func Name

func Name() string

func SetAPIBase

func SetAPIBase(url string)

func SetServicePath

func SetServicePath(service framework.Type, path string)

func SetStatusBase

func SetStatusBase(url string)

Types

type CredentialServiceConfig

type CredentialServiceConfig struct {
	// BatchCreateMaxItems set's the maximum amount of credentials that can be created in a single request.
	BatchCreateMaxItems int `toml:"batch_create_max_items" conf:"default:100"`
	// BatchUpdateStatusMaxItems set's the maximum amount of credentials statuses that can be updated in a single request.
	BatchUpdateStatusMaxItems int `toml:"batch_update_status_max_items" conf:"default:100"`
}

func (*CredentialServiceConfig) IsEmpty

func (c *CredentialServiceConfig) IsEmpty() bool

type DIDServiceConfig

type DIDServiceConfig struct {
	Methods                  []string `toml:"methods" conf:"default:key;web"`
	LocalResolutionMethods   []string `toml:"local_resolution_methods" conf:"default:key;peer;web;jwk;pkh"`
	UniversalResolverURL     string   `toml:"universal_resolver_url"`
	UniversalResolverMethods []string `toml:"universal_resolver_methods"`
	IONResolverURL           string   `toml:"ion_resolver_url"`
	// BatchCreateMaxItems set's the maximum amount that can be.
	BatchCreateMaxItems int `toml:"batch_create_max_items" conf:"default:100"`
}

func (*DIDServiceConfig) IsEmpty

func (d *DIDServiceConfig) IsEmpty() bool

type EncryptionConfig

type EncryptionConfig struct {
	DisableEncryption bool `toml:"disable_encryption" conf:"default:false"`

	// The URI for a master key. We use tink for envelope encryption as described in https://github.com/google/tink/blob/9bc2667963e20eb42611b7581e570f0dddf65a2b/docs/KEY-MANAGEMENT.md#key-management-with-tink
	// When left empty and DisableEncryption is off, then a random key is generated and used. This random key is persisted unencrypted in the
	// configured storage. Production deployments should never leave this field empty.
	MasterKeyURI string `toml:"master_key_uri"`

	// Path for credentials. Required when MasterKeyURI is set. More info at https://github.com/google/tink/blob/9bc2667963e20eb42611b7581e570f0dddf65a2b/docs/KEY-MANAGEMENT.md#credentials
	KMSCredentialsPath string `toml:"kms_credentials_path"`
}

func (EncryptionConfig) EncryptionEnabled

func (e EncryptionConfig) EncryptionEnabled() bool

func (EncryptionConfig) GetKMSCredentialsPath

func (e EncryptionConfig) GetKMSCredentialsPath() string

func (EncryptionConfig) GetMasterKeyURI

func (e EncryptionConfig) GetMasterKeyURI() string

type Environment

type Environment string

type EnvironmentVariable

type EnvironmentVariable string

func (EnvironmentVariable) String

func (e EnvironmentVariable) String() string

type KeyStoreServiceConfig

type KeyStoreServiceConfig struct {
	EncryptionConfig
}

func (*KeyStoreServiceConfig) EncryptionEnabled

func (k *KeyStoreServiceConfig) EncryptionEnabled() bool

func (*KeyStoreServiceConfig) GetKMSCredentialsPath

func (k *KeyStoreServiceConfig) GetKMSCredentialsPath() string

func (*KeyStoreServiceConfig) GetMasterKeyURI

func (k *KeyStoreServiceConfig) GetMasterKeyURI() string

func (*KeyStoreServiceConfig) IsEmpty

func (k *KeyStoreServiceConfig) IsEmpty() bool

type SSIServiceConfig

type SSIServiceConfig struct {
	Server   ServerConfig   `toml:"server"`
	Services ServicesConfig `toml:"services"`
}

func LoadConfig

func LoadConfig(path string, fs fs.FS) (*SSIServiceConfig, error)

LoadConfig attempts to load a TOML config file from the given path, and coerce it into our object model. Before loading, defaults are applied on certain properties, which are overwritten if specified in the TOML file.

type ServerConfig

type ServerConfig struct {
	Environment         Environment   `toml:"env" conf:"default:dev"`
	APIHost             string        `toml:"api_host" conf:"default:0.0.0.0:3000"`
	JagerHost           string        `toml:"jager_host" conf:"default:http://jaeger:14268/api/traces"`
	JagerEnabled        bool          `toml:"jager_enabled" conf:"default:false"`
	ReadTimeout         time.Duration `toml:"read_timeout" conf:"default:5s"`
	WriteTimeout        time.Duration `toml:"write_timeout" conf:"default:5s"`
	ShutdownTimeout     time.Duration `toml:"shutdown_timeout" conf:"default:5s"`
	LogLocation         string        `toml:"log_location" conf:"default:log"`
	LogLevel            string        `toml:"log_level" conf:"default:debug"`
	EnableSchemaCaching bool          `toml:"enable_schema_caching" conf:"default:true"`
	EnableAllowAllCORS  bool          `toml:"enable_allow_all_cors" conf:"default:false"`
}

ServerConfig represents configurable properties for the HTTP server

type ServicesConfig

type ServicesConfig struct {
	// at present, it is assumed that a single storage provider works for all services
	// in the future it may make sense to have per-service storage providers (e.g. mysql for one service,
	// mongo for another)
	StorageProvider string           `toml:"storage" conf:"default:bolt"`
	StorageOptions  []storage.Option `toml:"storage_option"`
	ServiceEndpoint string           `toml:"service_endpoint" conf:"default:http://localhost:8080"`
	StatusEndpoint  string           `toml:"status_endpoint"`

	// Application level encryption configuration. Defines how values are encrypted before they are stored in the
	// configured KV store.
	AppLevelEncryptionConfiguration EncryptionConfig `toml:"storage_encryption,omitempty"`

	// Embed all service-specific configs here. The order matters: from which should be instantiated first, to last
	KeyStoreConfig   KeyStoreServiceConfig   `toml:"keystore,omitempty"`
	DIDConfig        DIDServiceConfig        `toml:"did,omitempty"`
	CredentialConfig CredentialServiceConfig `toml:"credential,omitempty"`
	WebhookConfig    WebhookServiceConfig    `toml:"webhook,omitempty"`
}

ServicesConfig represents configurable properties for the components of the SSI Service

type WebhookServiceConfig

type WebhookServiceConfig struct {
	WebhookTimeout string `toml:"webhook_timeout" conf:"default:10s"`
}

func (*WebhookServiceConfig) IsEmpty

func (p *WebhookServiceConfig) IsEmpty() bool

Jump to

Keyboard shortcuts

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