config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package config loads GoForge's project configuration from goforge.yaml, a .env file and the process environment.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DotEnvPath

func DotEnvPath(configPath string) string

DotEnvPath returns the .env path Load() reads relative to configPath: the same directory, named ".env".

func ResolveEnvPath

func ResolveEnvPath(configPath, override string) string

ResolveEnvPath returns the .env path to use: override if non-empty, otherwise DotEnvPath(configPath). Callers that need to know where .env lives (init, doctor) without going through Load should use this instead of duplicating the fallback rule.

Types

type Config

type Config struct {
	Database struct {
		Driver string `yaml:"driver"`
		URL    string `yaml:"url"`
	} `yaml:"database"`
	Migrations struct {
		Path string `yaml:"path"`
	} `yaml:"migrations"`
	// Language is the optional UI language ("en"/"es") for human-facing CLI
	// output. --lang and GOFORGE_LANG take precedence over it.
	Language string `yaml:"language"`
}

Config is the parsed content of goforge.yaml, with ${VAR} references expanded against the environment (after .env has been loaded into it).

func Load

func Load(path, envPath string) (*Config, error)

Load reads goforge.yaml from path, first loading a .env file into the process environment so ${VAR} references in the YAML resolve. It does not overwrite variables already set in the environment.

envPath picks which .env to load. An empty string falls back to DotEnvPath(path): the same directory as path, named ".env".

Jump to

Keyboard shortcuts

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