cli

package
v1.1.44 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildConnectString

func BuildConnectString(urlStr, userStr, passwordStr string) (string, error)

BuildConnectString builds a valid nats connection string given an url, user and passward

func Parse

func Parse(cli any) string

Parse parses the command line interface and returns the selected command

Types

type Customer

type Customer struct {
	Customer string `help:"customer" default:"unknown-customer"`
}

type Database

type Database struct {
	DbHost   string `help:"database host" default:"127.0.0.1" json:"db-host"`
	Database string `help:"database" json:"database"`
	DbUser   string `help:"database user" json:"db-user"`
	DbPass   string `help:"database password" json:"db-pass"`
	DbPort   int    `help:"database port" min:"0" max:"65535" json:"db-port"`
}

type LogLevel

type LogLevel struct {
	Log string `help:"log level (trace|debug|info|error)" short:"l" default:"info"`
}

LogLevel is the log level

type NatsConfig

type NatsConfig struct {
	NatsUrls
	NatsUser
	NatsPass
}

NatsConfig is a configuration structure for NATS.

func NewNatsConfig

func NewNatsConfig(natsUrls []string, natsUser, natsPass string) *NatsConfig

NewNatsConfig creates a new NatsConfig.

func (*NatsConfig) NatsConnectString

func (n *NatsConfig) NatsConnectString(serverIndex int) (string, error)

NatsConnectString returns a connection string to be used to connect to a NATS server.

type NatsPass

type NatsPass struct {
	Pass string `help:"NATS server password." short:"p" default:""`
}

NatsPass holds the password to connect to a NATS server.

type NatsUrls

type NatsUrls struct {
	//Servers []string `help:"NATS server URLs." short:"s" default:"wss://megalarm:megalarm@nats.megalarm.fr:443"`
	Servers []string `help:"NATS server URLs." short:"s" default:"nats://nats:4222"`
}

NatsUrls holds the URLs of the NATS servers.

type NatsUser

type NatsUser struct {
	User string `help:"NATS server user." short:"u" default:""`
}

NatsUser holds the user to connect to a NATS server.

type Password

type Password struct {
	Password string `help:"password" short:"p" json:"password"`
}

type Run

type Run struct {
	Run struct{} `cmd:"" help:"run the microservice."`
}

Run is the command to run the microservice

type TCPPort

type TCPPort struct {
	Port int `help:"port" short:"P" min:"0" max:"65535"`
}

LogLevel is the log level

type Username

type Username struct {
	Username string `help:"username" short:"u" json:"username"`
}

Jump to

Keyboard shortcuts

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