sysconfig

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package sysconfig provides system configuration management.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SaveCustomerPortalConfig added in v0.5.0

func SaveCustomerPortalConfig(db *sql.DB, cfg CustomerPortalConfig, userID int) error

SaveCustomerPortalConfig persists portal settings as sysconfig overrides.

func SaveCustomerPortalConfigForCompany added in v0.5.0

func SaveCustomerPortalConfigForCompany(db *sql.DB, customerID string, cfg CustomerPortalConfig, userID int) error

SaveCustomerPortalConfigForCompany writes overrides scoped to a specific customer, creating defaults on demand.

Types

type CustomerPortalConfig added in v0.5.0

type CustomerPortalConfig struct {
	Enabled       bool
	LoginRequired bool
	Title         string
	FooterText    string
	LandingPage   string
}

CustomerPortalConfig holds global portal settings stored in sysconfig tables.

func DefaultCustomerPortalConfig added in v0.5.0

func DefaultCustomerPortalConfig() CustomerPortalConfig

DefaultCustomerPortalConfig returns the built-in defaults when no sysconfig rows exist.

func LoadCustomerPortalConfig added in v0.5.0

func LoadCustomerPortalConfig(db *sql.DB) (CustomerPortalConfig, error)

LoadCustomerPortalConfig reads portal settings from sysconfig tables.

func LoadCustomerPortalConfigForCompany added in v0.5.0

func LoadCustomerPortalConfigForCompany(db *sql.DB, customerID string) (CustomerPortalConfig, error)

LoadCustomerPortalConfigForCompany returns overrides for a specific customer when present, falling back to global values.

type DeployedConfig

type DeployedConfig struct {
	Version   string                 `yaml:"version"`
	Timestamp time.Time              `yaml:"timestamp"`
	Settings  map[string]interface{} `yaml:"settings"`
	Metadata  map[string]interface{} `yaml:"metadata"`
}

DeployedConfig represents the deployed configuration file structure.

type Manager

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

Manager handles system configuration loading and deployment.

func NewManager

func NewManager(db *sql.DB) *Manager

NewManager creates a new configuration manager.

func (*Manager) Deploy

func (m *Manager) Deploy(outputPath string) error

Deploy generates configuration files from database settings.

func (*Manager) Get

func (m *Manager) Get(name string) (interface{}, error)

Get retrieves a configuration value.

func (*Manager) GetArray

func (m *Manager) GetArray(name string) []string

GetArray retrieves an array configuration value.

func (*Manager) GetBool

func (m *Manager) GetBool(name string) bool

GetBool retrieves a boolean configuration value.

func (*Manager) GetInt

func (m *Manager) GetInt(name string) int

GetInt retrieves an integer configuration value.

func (*Manager) GetSettings

func (m *Manager) GetSettings() map[string]*Setting

GetSettings returns all settings for UI display.

func (*Manager) GetString

func (m *Manager) GetString(name string) string

GetString retrieves a string configuration value.

func (*Manager) Load

func (m *Manager) Load() error

Load loads all configuration settings from the database.

func (*Manager) Reset

func (m *Manager) Reset(name string, userID int) error

Reset resets a setting to its default value.

func (*Manager) Set

func (m *Manager) Set(name, value string, userID int) error

Set updates a configuration value.

type Option

type Option struct {
	Value string `json:"value"`
	Label string `json:"label"`
}

Option represents a select option.

type Setting

type Setting struct {
	ID                       int       `json:"id"`
	Name                     string    `json:"name"`
	Description              string    `json:"description"`
	Navigation               string    `json:"navigation"`
	IsInvisible              bool      `json:"is_invisible"`
	IsReadonly               bool      `json:"is_readonly"`
	IsRequired               bool      `json:"is_required"`
	IsValid                  bool      `json:"is_valid"`
	HasConfigLevel           int       `json:"has_configlevel"`
	UserModificationPossible bool      `json:"user_modification_possible"`
	UserModificationActive   bool      `json:"user_modification_active"`
	XMLContentRaw            string    `json:"xml_content_raw"`
	XMLContentParsed         string    `json:"xml_content_parsed"`
	XMLFilename              string    `json:"xml_filename"`
	EffectiveValue           string    `json:"effective_value"`
	CreateTime               time.Time `json:"create_time"`
	ChangeTime               time.Time `json:"change_time"`
	CreateBy                 int       `json:"create_by"`
	ChangeBy                 int       `json:"change_by"`

	// Parsed configuration data
	Type         string      `json:"type"`
	Default      interface{} `json:"default"`
	Options      []Option    `json:"options,omitempty"`
	Min          *int        `json:"min,omitempty"`
	Max          *int        `json:"max,omitempty"`
	Validation   string      `json:"validation,omitempty"`
	DependsOn    string      `json:"depends_on,omitempty"`
	DependsValue string      `json:"depends_value,omitempty"`
}

Setting represents a configuration setting.

Jump to

Keyboard shortcuts

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