config

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Overview

Package config is responsible for reading and managing supervisor and planner configuration.

Index

Constants

View Source
const (
	DefaultPort                = 8080
	DefaultLogLevel            = "info"
	DefaultBaseFolder          = "import"
	DefaultDropCypherFile      = "drop.cypher"
	DefaultSchemaFolderName    = "schema"
	DefaultSchemaMigrationType = "up_down"
	DefaultNodeLabel           = "GraphToolMigration"
	DefaultNodeSubString       = "Version"
	DefaultFolderMigrationType = "change"
	DefaultInitialBatch        = "schema"
	DefaultNeo4jDatabase       = "neo4j"
	DefaultCypherShellFormat   = "auto"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchDetail

type BatchDetail struct {
	Folders []string `mapstructure:"folders"`
}

type Config

type Config struct {
	Supervisor *Supervisor `mapstructure:"supervisor"`
	Planner    *Planner    `mapstructure:"planner"`
}

func LoadFile

func LoadFile(fileName string) (*Config, error)

LoadFile loads file into config, together with values from environment variables and default values.

func New

func New() (*Config, error)

New creates a new config containing values from environment variables and default values.

func (*Config) Normalize

func (c *Config) Normalize() error

Normalize will set default values for some dynamic parts of config

It first calls Validate() to be sure all required structures are in place. This is only case, when function might return error. If you called Validate before, you are free to ignore this error.

func (*Config) Validate

func (c *Config) Validate() error

Validate validates that data in Config struct are filled in correctly. Supervisor is not required, but if it is present, is validate.

func (*Config) ValidateWithSupervisor

func (c *Config) ValidateWithSupervisor() error

ValidateWithSupervisor validates that data in Config struct are filled in correctly with mandatory supervisor part. This is like Validate() but if Supervisor is missing, error will be thrown.

type FolderDetail

type FolderDetail struct {
	MigrationType string   `mapstructure:"migration_type"`
	NodeLabels    []string `mapstructure:"node_labels"`
}

type Planner

type Planner struct {
	Batches         map[string]*BatchDetail  `mapstructure:"batches"`
	SchemaFolder    *SchemaFolder            `mapstructure:"schema_folder"`
	Folders         map[string]*FolderDetail `mapstructure:"folders"`
	AllowedCommands map[string]string        `mapstructure:"allowed_commands"`

	BaseFolder        string `mapstructure:"base_folder"`
	DropCypherFile    string `mapstructure:"drop_cypher_file"`
	CypherShellFormat string `mapstructure:"cypher_shell_format"`
}

type SchemaFolder

type SchemaFolder struct {
	FolderName    string   `mapstructure:"folder_name"`
	MigrationType string   `mapstructure:"migration_type"`
	NodeLabels    []string `mapstructure:"node_labels"`
}

type Supervisor

type Supervisor struct {
	LogLevel            string `mapstructure:"log_level"`
	DefaultGraphVersion string `mapstructure:"default_graph_version"`
	InitialBatch        string `mapstructure:"initial_batch"`
	Neo4jAuth           string `mapstructure:"neo4j_auth"`
	Neo4jDatabase       string `mapstructure:"neo4j_database"`
	Port                int    `mapstructure:"port"`
}

Jump to

Keyboard shortcuts

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