config

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package config provides configuration management for the scale service, including environment-specific settings and runtime configuration updates.

Index

Constants

This section is empty.

Variables

View Source
var (
	BuildEnvironment = "local"
	BuildDate        = "unknown"
	BuildTime        = "unknown"
)

Build variables (injected via ldflags)

View Source
var Environments = map[string]Environment{
	"remote": {
		Name:        "REMOTO",
		ServiceName: "R2k_BasculaServicio_Remote",
		ListenAddr:  "0.0.0.0:8765",
		DefaultPort: "COM3",
		DefaultMode: false,
	},
	"local": {
		Name:        "LOCAL",
		ServiceName: "R2k_BasculaServicio_Local",
		ListenAddr:  "localhost:8765",
		DefaultPort: "COM3",
		DefaultMode: false,
	},
}

Environments defines available deployment configurations

Functions

This section is empty.

Types

type Config

type Config struct {
	Puerto     string
	Marca      string
	ModoPrueba bool
	Ambiente   string
	Dir        string
	// contains filtered or unexported fields
}

Config holds the runtime configuration for the scale service

func New

func New(env Environment) *Config

New creates a Config initialized from the environment

func (*Config) Get

func (c *Config) Get() Snapshot

Get returns a snapshot of the current configuration

func (*Config) Update

func (c *Config) Update(puerto, marca string, modoPrueba bool) bool

Update applies new configuration values Returns true if any value changed

type Environment

type Environment struct {
	Name        string
	ServiceName string
	ListenAddr  string
	DefaultPort string
	DefaultMode bool // true = test mode (simulated weights), false = real weights
}

Environment holds environment-specific settings

func GetEnvironment

func GetEnvironment(env string) Environment

GetEnvironment returns config for the specified environment Falls back to "prod" if unknown

type Snapshot

type Snapshot struct {
	Puerto     string
	Marca      string
	ModoPrueba bool
	Ambiente   string
	Dir        string
}

Snapshot is an immutable copy of configuration

Jump to

Keyboard shortcuts

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