satus

package module
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2025 License: MIT Imports: 10 Imported by: 1

README

satus

Go Reference Go Report Card

Configuration management, status monitoring, and application observability

Installation

go get github.com/ternarybob/satus@latest

Usage

import "github.com/ternarybob/satus"

// Your code here

Features

Examples

Documentation

Full documentation is available at pkg.go.dev.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

This library is part of the T3B ecosystem:

  • funktion - Core utility functions
  • satus - Configuration and status management
  • arbor - Structured logging system
  • omnis - Web framework integrations

Documentation

Index

Constants

View Source
const (
	CONFIG_AUTHENTICATION_URL = "auth_url"
	CONFIG_PRIVATEADR         = "private_addr"
)
View Source
const (
	ConfigName string = "config::applicationconfig"
)

Variables

View Source
var (
	Version   = "dev"     // Set via -ldflags "-X main.Version=x.x.x"
	BuildTime = "unknown" // Set via -ldflags "-X main.BuildTime=..."
	GitCommit = "unknown" // Set via -ldflags "-X main.GitCommit=..."
)

Version information - set at build time via ldflags

Functions

func GetKeepFiles added in v1.0.12

func GetKeepFiles() int

GetKeepFiles returns the number of log files to keep

func GetLogLevel added in v1.0.12

func GetLogLevel() string

GetLogLevel returns the configured log level as a string

func GetLogLocation added in v1.0.12

func GetLogLocation() string

GetLogLocation returns the configured log file location

func GetServiceDirection

func GetServiceDirection(serviceName string) string

GetServiceDirection returns the direction for a specific service by name

Types

type AppConfig

type AppConfig struct {
	// contains filtered or unexported fields
}

func GetAppConfig

func GetAppConfig() *AppConfig

GetAppConfig ...

func (*AppConfig) GetScopedDataConnection

func (cfg *AppConfig) GetScopedDataConnection(name string) (DataConfig, error)

GetScopedDataConnection ...

func (*AppConfig) GetScopedDataConnectionbyType

func (cfg *AppConfig) GetScopedDataConnectionbyType(t string) (DataConfig, error)

type DataConfig

type DataConfig struct {
	Name     string   `json:"name" fig:"name" default:"Connection"`
	Scope    []string `fig:"scope" default:"[default]"`
	Type     string   `fig:"type"`
	Hosts    []string `fig:"hosts" default:"[localhost]"`
	Port     string   `fig:"port"`
	Database string   `fig:"database" default:"dashs"`
	ConnStr  string   `json:"-" fig:"connstr" default:""`
	Username string   `json:"-"`
	Password string   `json:"-"`
	Cert     string   `fig:"cert"`
	Key      string   `fig:"key"`
}

type LoggingConfig added in v1.0.12

type LoggingConfig struct {
	KeepFiles int    `json:"keep_files" fig:"keep_files" default:"5"`
	Location  string `json:"location" fig:"location" default:"./logs/app.log"`
	LogLevel  string `json:"loglevel" fig:"loglevel" default:"info"`
}

func GetLoggingConfig added in v1.0.12

func GetLoggingConfig() LoggingConfig

GetLoggingConfig returns the logging configuration

type ServiceConfig

type ServiceConfig struct {
	Name       string `json:"name" fig:"name" default:"Service"`
	Direction  string `json:"direction" fig:"direction" default:"in"`
	Type       string `json:"type" fig:"type" default:"api"`
	Scope      string `json:"scope" fig:"scope" default:"DEV"`
	Url        string `json:"url" fig:"url" default:":8080"`
	Port       int    `json:"port" fig:"port" default:"8080"`
	Host       string `json:"host" fig:"host" default:"localhost"`
	MockUser   string `json:"mockuser" fig:"mockuser" default:"mockuser@dashs.com"`
	Connection string `json:"connection" fig:"connection" default:""`
}

func GetFirstServiceByDirection

func GetFirstServiceByDirection(direction string) (*ServiceConfig, error)

GetFirstServiceByDirection returns the first service matching the specified direction

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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