schema

package
v0.0.0-...-5069d0e Latest Latest
Warning

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

Go to latest
Published: May 11, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package schema contains shared configuration definitions.

There must be no use of other DTOs in this package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigInject

func ConfigInject(consumer, provider any) error

ConfigInject injects configuration into service.

Types

type APIConfiguration

type APIConfiguration struct {
	Host       string `yaml:"host"`
	Port       int    `yaml:"port"`
	StaticPath string `yaml:"staticPath"`
}

APIConfiguration - API-related configuration.

type Configuration

type Configuration struct {
	API            APIConfiguration      `yaml:"api"`
	DB             DatabaseConfiguration `yaml:"db"`
	PrivateKeyPath string                `yaml:"privateKeyPath"`
	Debug          bool                  `yaml:"debug"`
	// contains filtered or unexported fields
}

Configuration - overall system configuration.

func (Configuration) GetPrivateKey

func (s Configuration) GetPrivateKey() (ed25519.PrivateKey, error)

GetPrivateKey returns private key value from the loaded configuration.

type DatabaseConfiguration

type DatabaseConfiguration struct {
	Host          string `yaml:"host"`
	Port          int    `yaml:"port"`
	DatabaseName  string `yaml:"databaseName"`
	Username      string `yaml:"username"`
	Password      string `yaml:"password" env:"POSTGRES_PASSWORD"`
	MigrationsDir string `yaml:"migrationsDir"`
}

DatabaseConfiguration - DB-related configuration.

Note that for fields with `env` tag, environment variable value has priority over yaml value.

type RequiresConfig

type RequiresConfig interface {
	// UseConfig attaches configuration to the service.
	UseConfig(*Configuration)
}

RequiresConfig can use configuration.

type WithConfig

type WithConfig interface {
	// Config returns used configuration.
	Config() *Configuration
}

WithConfig can return configuration.

Jump to

Keyboard shortcuts

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