base

package
v0.60.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AppDirName application's directory name.
	AppDirName = "felice-n-franz"

	// AppName application name.
	AppName = "Felice & Franz"

	// DefaultServerAPIVersion idem.
	DefaultServerAPIVersion = "/api/v1"

	// DefaultCA Kafka Certificate's filename.
	DefaultCA = "kafkacert.pem"

	// DefaultPort application's default port.
	DefaultPort = 9191
)
View Source
const (
	// CurrentConfigFileVersion current or default config file version.
	CurrentConfigFileVersion = 1
)

Variables

This section is empty.

Functions

func SetDefaults

func SetDefaults()

SetDefaults sets configuration defaults.

Types

type Config

type Config struct {
	Version  int           `json:"version"`
	FirstRun bool          `json:"firstRun"`
	Port     int           `json:"port"`
	Envs     []Environment `json:"envs"`
}

Config implements the rtc.Config interface.

var (

	// AppVersion application's version.
	AppVersion version.Version

	// Conf application's global configuration.
	Conf Config

	// UserConf application's global configuration, read during load.
	UserConf Config
)

func Validate added in v0.59.3

func Validate() *Config

Validate validates application's configuration.

func (*Config) GetEnvConfig

func (c *Config) GetEnvConfig(envName string) (env Environment)

GetEnvConfig returns the configuration for the given environment.

func (*Config) GetEnvGroupTopics

func (c *Config) GetEnvGroupTopics(envName, groupID string) (topics []Topic)

GetEnvGroupTopics returns the list of topics in a given group, for a given environment.

func (*Config) GetEnvGroups

func (c *Config) GetEnvGroups(envName string) (groups []Group)

GetEnvGroups returns the list of groups in the given environment.

func (*Config) GetEnvTopics

func (c *Config) GetEnvTopics(envName string) (topics []Topic)

GetEnvTopics returns the list of topics for the given environment.

func (*Config) GetEnvsList

func (c *Config) GetEnvsList() (list []string)

GetEnvsList returns the list of availablr environments.

func (*Config) GetFirstRun added in v0.59.3

func (c *Config) GetFirstRun() bool

func (*Config) GetPort

func (c *Config) GetPort() string

GetPort returns port as a string.

func (*Config) GetURL

func (c *Config) GetURL() string

GetURL returns application's base URL.

func (*Config) SetDefaults added in v0.59.3

func (c *Config) SetDefaults()

func (*Config) SetFirstRun added in v0.59.3

func (c *Config) SetFirstRun(v bool)

func (*Config) SetLockFile added in v0.60.0

func (c *Config) SetLockFile(_ lockfile.Lockfile)

type EnvSchemas

type EnvSchemas map[string]interface{}

EnvSchemas defines common JSON schemas.

type EnvVars

type EnvVars map[string]string

EnvVars defines the Environment Vars type.

type Environment

type Environment struct {
	Name           string          `json:"name"`
	Active         bool            `json:"active"`
	AssignConsumer bool            `json:"assignConsumer"`
	Configuration  kafka.ConfigMap `json:"configuration"`
	Vars           EnvVars         `json:"vars"`
	HeaderPrefix   string          `json:"headerPrefix"`
	TopicsFrom     string          `json:"inheritFrom"`
	Schemas        EnvSchemas      `json:"schemas"`
	Topics         []Topic         `json:"topics"`
	Groups         []Group         `json:"groups"`
}

Environment defines a topics environment. FIXME: DEPRECATE AssignConsumer

func (*Environment) AllTopicsExist

func (e *Environment) AllTopicsExist(keys []string) (exist bool)

AllTopicsExist check if all topics exist for the given keys.

func (*Environment) FindTopic

func (e *Environment) FindTopic(key string) (v Topic, err error)

FindTopic looks for topic by key.

func (*Environment) FindTopicValues

func (e *Environment) FindTopicValues(keys []string) (values []string, err error)

FindTopicValues looks for all topics in the given keys list.

func (*Environment) FindTopics

func (e *Environment) FindTopics(keys []string) (topics []Topic, err error)

FindTopics looks for all topics in the given keys list.

func (*Environment) GetTopic

func (e *Environment) GetTopic(value string) (v Topic, err error)

GetTopic returns the topic matching the given value.

type Group

type Group struct {
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Category    string   `json:"category"`
	ID          string   `json:"id"`
	Keys        []string `json:"keys"`
}

Group defines a group of topics.

type Header struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

Header defines the Headers type.

type Topic

type Topic struct {
	Name        string      `json:"name"`
	Description string      `json:"description"`
	Key         string      `json:"key"`
	Value       string      `json:"value"`
	GroupID     string      `json:"groupId"`
	Headers     []Header    `json:"headers"`
	Schema      TopicSchema `json:"schema"`
}

Topic defines a topic structure.

type TopicSchema

type TopicSchema map[string]interface{}

TopicSchema defines the applicable JSON schema.

Jump to

Keyboard shortcuts

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