config

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: MIT Imports: 2 Imported by: 0

README

⚙️ Configuration Manager (internal/config)

internal/config provides centralized configuration loading from environment variables and CLI flags.


📦 Key Exports

Config Struct
type Config struct {
    Role         string // Deployment role (all, api, worker, scheduler)
    Port         string // HTTP API port (default: "8080")
    DatabasePath string // SQLite file path or Postgres DSN (default: "pinggopher.db")
    RedisAddr    string // Redis broker address for gopher-queue (default: "localhost:6379")
    JWTSecret    string // Secret key for JWT signing
}
LoadConfig() *Config

Parses command-line flags and falls back to environment variables (ROLE, PORT, DB_PATH, REDIS_ADDR, JWT_SECRET) if set.


💡 Usage Example

package main

import (
    "fmt"
    "github.com/pinggopher/ping-gopher/internal/config"
)

func main() {
    cfg := config.LoadConfig()
    fmt.Printf("Starting PingGopher on port %s (Role: %s)\n", cfg.Port, cfg.Role)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Role         string
	Port         string
	DatabasePath string
	RedisAddr    string
	JWTSecret    string
}

Config holds runtime configuration options for PingGopher.

func LoadConfig

func LoadConfig() *Config

LoadConfig initializes configuration from CLI flags and environment variables.

Jump to

Keyboard shortcuts

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