config

package
v0.0.0-...-89805ac Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

README

Configuration

Configuration is managed using a TOML file. There are sets of configuration values for the server (e.g. which port to listen on), the services (e.g. which database to use), and each service.

Each service may define specific configuration, such as which DID methods are enabled for the DID service.

Usage

The service, upon boot, looks for a file called config.toml to find its configuration.

There are a number of configuration files in this directory provided as defaults. Specifically, config.toml is intended to be used when the service is run as a local go process. There is another file, compose.toml, which is intended to be used when the service is run via docker compose. To make this switch, it's recommended that one renames the file to config.toml and then maintains the original compose.toml file as local.toml or similar.

Documentation

Index

Constants

View Source
const (
	DefaultConfigPath = "config/config.toml"
	ConfigFileName    = "config.toml"
	ServiceName       = "ssi-service"
	ConfigExtension   = ".toml"

	DefaultServiceEndpoint = "http://localhost:8080"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseServiceConfig

type BaseServiceConfig struct {
	Name            string `toml:"name"`
	ServiceEndpoint string `toml:"service_endpoint"`
}

BaseServiceConfig represents configurable properties for a specific component of the SSI Service Can be wrapped and extended for any specific service config

type CredentialServiceConfig

type CredentialServiceConfig struct {
	*BaseServiceConfig
}

func (*CredentialServiceConfig) IsEmpty

func (c *CredentialServiceConfig) IsEmpty() bool

type DIDServiceConfig

type DIDServiceConfig struct {
	*BaseServiceConfig
	Methods           []string `toml:"methods"`
	ResolutionMethods []string `toml:"resolution_methods"`
}

func (*DIDServiceConfig) IsEmpty

func (d *DIDServiceConfig) IsEmpty() bool

type IssuingServiceConfig

type IssuingServiceConfig struct {
	*BaseServiceConfig
}

func (*IssuingServiceConfig) IsEmpty

func (s *IssuingServiceConfig) IsEmpty() bool

type KeyStoreServiceConfig

type KeyStoreServiceConfig struct {
	*BaseServiceConfig
	// Service key password. Used by a KDF whose key is used by a symmetric cypher for key encryption.
	// The password is salted before usage.
	ServiceKeyPassword string `toml:"password"`
}

func (*KeyStoreServiceConfig) IsEmpty

func (k *KeyStoreServiceConfig) IsEmpty() bool

type ManifestServiceConfig

type ManifestServiceConfig struct {
	*BaseServiceConfig
}

func (*ManifestServiceConfig) IsEmpty

func (m *ManifestServiceConfig) IsEmpty() bool

type PresentationServiceConfig

type PresentationServiceConfig struct {
	*BaseServiceConfig
}

func (*PresentationServiceConfig) IsEmpty

func (p *PresentationServiceConfig) IsEmpty() bool

type SSIServiceConfig

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

func LoadConfig

func LoadConfig(path string) (*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 SchemaServiceConfig

type SchemaServiceConfig struct {
	*BaseServiceConfig
}

func (*SchemaServiceConfig) IsEmpty

func (s *SchemaServiceConfig) IsEmpty() bool

type ServerConfig

type ServerConfig struct {
	APIHost             string        `toml:"api_host" conf:"default:0.0.0.0:3000"`
	DebugHost           string        `toml:"debug_host" conf:"default:0.0.0.0:4000"`
	JagerHost           string        `toml:"jager_host" conf:"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"`
}

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"`
	StorageOption   interface{} `toml:"storage_option"`
	ServiceEndpoint string      `toml:"service_endpoint"`

	// 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"`
	IssuingServiceConfig IssuingServiceConfig      `toml:"issuing,omitempty"`
	SchemaConfig         SchemaServiceConfig       `toml:"schema,omitempty"`
	CredentialConfig     CredentialServiceConfig   `toml:"credential,omitempty"`
	ManifestConfig       ManifestServiceConfig     `toml:"manifest,omitempty"`
	PresentationConfig   PresentationServiceConfig `toml:"presentation,omitempty"`
}

ServicesConfig represents configurable properties for the components of the SSI Service

Jump to

Keyboard shortcuts

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