config

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Debug LogLevel = "debug" // Detailed debug information
	Info  LogLevel = "info"  // General operational information
	Warn  LogLevel = "warn"  // Warning messages for potentially harmful situations
	Error LogLevel = "error" // Error messages for serious problems

	// Log Formats define how log messages are structured
	Text LogFormat = "text" // Human-readable text format

	// Default configuration values
	DefaultVersion     = "1.0.0"   // Initial version number
	DefaultTimeFormat  = "RFC3339" // Standard time format (Not in use right now)
	DefaultRefreshRate = 5         // Dashboard refresh rate in seconds
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Dashboard

type Dashboard struct {
	Port        string `yaml:"port" validate:"required"`
	Theme       string `yaml:"theme" validate:"required"`
	RefreshRate int    `yaml:"refreshRate" validate:"required"`
}

type Database

type Database struct {
	Path string `yaml:"path" validate:"required"`
}

type JotlConfig

type JotlConfig struct {
	Version   string    `yaml:"version" json:"version"`     // Configuration version
	Project   Project   `yaml:"project" json:"project"`     // Project settings
	Database  Database  `yaml:"database" json:"database"`   // Database settings
	Logging   Logging   `yaml:"logging" json:"logging"`     // Logging settings
	Dashboard Dashboard `yaml:"dashboard" json:"dashboard"` // Dashboard settings
}

JotlConfig is the root configuration structure containing all settings

func LoadConfig

func LoadConfig(startDir string) (*JotlConfig, error)

LoadConfig reads and parses user YAML configuration file. This may be called every time you run `... dev` to verify user configs

func NewConfig

func NewConfig(name, loglevel, dbPath string) *JotlConfig

NewConfig creates a new configuration with default values.

func (*JotlConfig) SaveConfig

func (c *JotlConfig) SaveConfig(path string) error

func (*JotlConfig) SetDescription

func (c *JotlConfig) SetDescription(desc string)

SetDescription updates the project description.

func (*JotlConfig) SetLogLevel

func (c *JotlConfig) SetLogLevel(level string) error

SetLogLevel updates the logging level if valid.

func (*JotlConfig) SetProjectName

func (c *JotlConfig) SetProjectName(name string)

SetProjectName updates the project name.

type LogFormat

type LogFormat string

LogFormat represents the output format for log messages

type LogLevel

type LogLevel string

LogLevel represents the severity level of log messages

type Logging

type Logging struct {
	Level      LogLevel  `yaml:"level" validate:"required,oneof=error info debug warn"`
	Format     LogFormat `yaml:"format" validate:"required"`
	TimeFormat string    `yaml:"timeFormat" validate:"required"`
}

type PostgresConfig

type PostgresConfig struct {
	ContainerName string
	DBName        string
	User          string
	Password      string
	Port          string
	Volume        string
}

func DefaultPostgresConfig

func DefaultPostgresConfig() PostgresConfig

func (*PostgresConfig) CreateDockerCompose

func (pc *PostgresConfig) CreateDockerCompose(currentDir string, config PostgresConfig) error

type Project

type Project struct {
	Name        string `yaml:"name" validate:"required"`
	Description string `yaml:"description"`
}

Jump to

Keyboard shortcuts

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