config

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrNoContext        stringError = "no context in use"
	ErrParametersNumber stringError = "please provide parameter - value pairs"
	HiddenToken                     = "***"
)

Variables

This section is empty.

Functions

func AtomicSave added in v0.4.4

func AtomicSave(writer Writer, path string, tmpPrefix string, data interface{}) error

save some file atomically

func EndpointsFromParams added in v0.5.0

func EndpointsFromParams(cfgParams map[string]string) map[string]string

func SortedKeys added in v0.4.3

func SortedKeys[T any](m map[string]T) []string

Types

type Config

type Config struct {
	Name          string            `json:"name"`
	Type          string            `json:"type"`
	Customer      string            `json:"customer"`
	KeystoneURL   string            `json:"keystone"`
	OrionURL      string            `json:"orion"`
	IotamURL      string            `json:"iotam"`
	PerseoURL     string            `json:"perseo"`
	UrboURL       string            `json:"urbo"`
	OrchURL       string            `json:"orch"`
	PostgisURL    string            `json:"postgis"`
	JenkinsURL    string            `json:"jenkins"`
	PentahoURL    string            `json:"pentaho"`
	Service       string            `json:"service"`
	Subservice    string            `json:"subservice"`
	Database      string            `json:"database"`
	Schema        string            `json:"schema"`
	Username      string            `json:"username"`
	JenkinsLabel  string            `json:"jenkinsLabel"`
	JenkinsFolder string            `json:"jenkinsFolder"`
	BIConnection  string            `json:"biConnection"`
	Token         string            `json:"token,omitempty"`
	UrboToken     string            `json:"urbotoken,omitempty"`
	Params        map[string]string `json:"params,omitempty"`
	ProjectCache  []string          `json:"projects,omitempty"`
}

Config almacena información de conexión a un entorno

func FromBody added in v0.4.4

func FromBody(r *http.Request) (Config, error)

func FromHeaders added in v0.4.4

func FromHeaders(r *http.Request, store *Store) (Config, error)

func (*Config) HasToken added in v0.1.2

func (c *Config) HasToken() string

func (*Config) HasUrboToken added in v0.2.8

func (c *Config) HasUrboToken() string

func (*Config) Pairs added in v0.4.3

func (c *Config) Pairs() map[string]string

Pairs return all context parameters as a map of strings

func (*Config) SetCredentials added in v0.4.8

func (c *Config) SetCredentials(token, urboToken string)

func (*Config) String

func (c *Config) String() string

type Environment added in v0.3.7

type Environment struct {
	EnvironmentName string            `json:"environmentName"`
	EnvironmentType string            `json:"environmentType"`
	Customer        string            `json:"customer"`
	Service         string            `json:"service"`
	Database        string            `json:"database"`
	JenkinsLabel    string            `json:"jenkinsLabel"`
	JenkinsFolder   string            `json:"jenkinsFolder"`
	BIConnection    string            `json:"biConnection"`
	DatabaseSchemas map[string]string `json:"databaseSchemas"`
	Api             struct {
		Postgis      string `json:"postgis"`
		Orchestrator string `json:"orchestrator"`
		Orion        string `json:"orion"`
		Keystone     string `json:"keystone"`
		Perseo       string `json:"perseo"`
		Pentaho      string `json:"pentaho"`
		Urbo         string `json:"urbo"`
		Jenkins      string `json:"jenkins"`
	} `json:"api"`
	NotificationEndpoints map[string]string `json:"notificationEndpoints"`
}

Urbo-deployer Environment model

func FromConfig added in v0.3.7

func FromConfig(cfg Config) Environment

type FolderWriter added in v0.4.4

type FolderWriter string

Writer implementation for filesystem

func (FolderWriter) AtomicSave added in v0.4.4

func (rootFolder FolderWriter) AtomicSave(path string, tmpPrefix string, byteData []byte) error

save some file atomically

type Store

type Store struct {
	Path    string // It no longer contains full contexts, only context selector.
	DirPath string // this holds the actual contexts now
	Current Config
}

Store can manage several configs

func (*Store) CanConfig

func (s *Store) CanConfig() []string

CanConfig returns a list of parameter names recognized by `Set`

func (*Store) Create

func (s *Store) Create(name string) error

Create a named Context

func (*Store) Delete

func (s *Store) Delete(name string) error

Delete the named config, return the current one

func (*Store) Dup

func (s *Store) Dup(name string) error

Dup the current config with a new name

func (*Store) GetConfigDir added in v0.5.0

func (s *Store) GetConfigDir() (string, error)

get the proper paths in the new config model

func (*Store) Info

func (s *Store) Info(name string) (Config, error)

Info about a particular Config

func (*Store) List

func (s *Store) List(ignoreMissing bool) ([]string, error)

List available Configs

func (*Store) Read

func (s *Store) Read(contextName string) error

Read the config file

func (*Store) Save added in v0.4.3

func (s *Store) Save(cfg Config) error

Atomically save a config. Does not change current selection.

func (*Store) Server added in v0.4.3

func (s *Store) Server() http.Handler

func (*Store) Set

func (s *Store) Set(contextName string, strPairs map[string]string) ([]string, error)

func (*Store) SetParams

func (s *Store) SetParams(contextName string, pairs map[string]string) error

func (*Store) Use

func (s *Store) Use(name string) error

Use the named Config

type Writer added in v0.4.4

type Writer interface {
	AtomicSave(path, tmpPrefix string, data []byte) error
}

Generic interface for writing files

func PrefixWriter added in v0.4.4

func PrefixWriter(writer Writer, prefix string) Writer

PrefixWriter returns a writer that adds a prefix to every write

type WriterFunc added in v0.4.4

type WriterFunc func(path, tmpPrefix string, data []byte) error

PrefixWriter is a writer that appends a path prefix to every write

func (WriterFunc) AtomicSave added in v0.4.4

func (writer WriterFunc) AtomicSave(path string, tmpPrefix string, byteData []byte) error

AtomicSave implements Writer

Jump to

Keyboard shortcuts

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