Documentation
¶
Index ¶
- func ConfFolder() (confFolder string, err error)
- func ConfigFactory(cfPath string) sputnik.ConfFactory
- func LoadDockerComposeFile(url string) error
- func LoadEnv() error
- func ReadAppBlocks(confFolder string) ([]sputnik.BlockDescriptor, error)
- func Start(cntr sputnik.ServerConnector)
- func StartServices() (stopServices func(), err error)
- func StartServicesWithCompose(composePath string) (stopServices func(), err error)
- func UseEmbeddedConfiguration(efs *embed.FS) (cleanUp func(), err error)
- func WalkDir(root string, exts []string) ([]string, error)
- type Cleaner
- type Connector
- type MessageConsumer
- type MessageProducer
- type Runner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfFolder ¶ added in v0.0.14
Command line of sidecar : <exe name> --cf <path of config folder> ConfFolder() return the value of 'cf' flag
func ConfigFactory ¶
func ConfigFactory(cfPath string) sputnik.ConfFactory
ConfigFactory returns implementation of sputnik.ConfFactory based on github.com/tkanos/gonfig - JSON format of config files - Automatic matching of environment variables - Env. variable for configuration "example" and key "kname" should be set in environment as "EXAMPLE_KNAME" - Value in environment automatically overrides value from the file - Temporary used github.com/g41797/gonfig (till merge of PR)
func LoadDockerComposeFile ¶ added in v0.0.20
Loads docker-compose.yml file to configuration folder with name "docker-compose.yml" for further using by StartServices
func LoadEnv ¶ added in v0.0.19
func LoadEnv() error
Loads all *.env file from configuration folder of the process. Overwrites non-existing environment variables. Supports "prefixed" environment variables (https://github.com/g41797/gonfig#using-prefixes-for-environment-variables-name)
func ReadAppBlocks ¶
func ReadAppBlocks(confFolder string) ([]sputnik.BlockDescriptor, error)
func Start ¶
func Start(cntr sputnik.ServerConnector)
func StartServices ¶ added in v0.0.17
func StartServices() (stopServices func(), err error)
Starts docker compose on 'docker-compose.yml' from configuration folder Does not wait finish.
func StartServicesWithCompose ¶ added in v0.0.17
func UseEmbeddedConfiguration ¶ added in v0.0.18
UseEmbeddedConfiguration creates temporary directory and copies configuration files embedded within package. For success returns cleanUp function for removing created directory Use this function in main function if you don't supply path to config directory in command line. Example:
import (
"embed" .......
)
go:embed configdir var cnffiles embed.FS
func main() { cleanup, err := sidecar.UseEmbeddedConfiguration(&cnffiles) if err != nil { return err } defer cleanup() sidecar.Start(new(adapter.BrokerConnector)) }
Types ¶
type Cleaner ¶ added in v0.0.21
type Cleaner struct {
// contains filtered or unexported fields
}
Emulates stack of cleanup functions
type Connector ¶ added in v0.0.13
type Connector interface { // Connect to the broker or attach to existing shared Connect(cf sputnik.ConfFactory, shared sputnik.ServerConnection) error // For shared connection - detach, for own - close Disconnect() }
Connector provides possibility for negotiation between sputnik based software and external broker process
type MessageConsumer ¶ added in v0.0.13
type MessageConsumer interface { Connector // Receive event from broker, convert to sputnik.Msg // and send to another block Consume(sender sputnik.BlockCommunicator) error }
type MessageProducer ¶
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
func StartRunner ¶
func StartRunner(confFolder string, cntr sputnik.ServerConnector) (*Runner, error)