Documentation
¶
Overview ¶
v2/cmd/forge/config/loader.go
v2/cmd/forge/config/types.go
Index ¶
- func CreateForgeConfig(path string, config *ForgeConfig) error
- func SaveForgeConfig(config *ForgeConfig, path string) error
- func ValidateConfig(config *ForgeConfig) error
- type BuildApp
- type BuildConfig
- type ConnectionConfig
- type DatabaseCodegenConfig
- type DatabaseConfig
- type DeployConfig
- type DevConfig
- type DockerConfig
- type EnvironmentConfig
- type ForgeConfig
- type GenerateConfig
- type GeneratorConfig
- type HotReloadConfig
- type KubernetesConfig
- type Platform
- type ProjectConfig
- type StructureConfig
- type TestConfig
- type WatchConfig
- type WorkspaceConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateForgeConfig ¶
func CreateForgeConfig(path string, config *ForgeConfig) error
CreateForgeConfig creates a new .forge.yaml file with default or provided config
func SaveForgeConfig ¶
func SaveForgeConfig(config *ForgeConfig, path string) error
SaveForgeConfig saves the configuration to a file
func ValidateConfig ¶
func ValidateConfig(config *ForgeConfig) error
ValidateConfig validates the configuration
Types ¶
type BuildApp ¶
type BuildApp struct {
Name string `yaml:"name"`
Module string `yaml:"module"` // Multi-module: path to module
Cmd string `yaml:"cmd"` // Path to main.go
Output string `yaml:"output"` // Binary name
Dockerfile string `yaml:"dockerfile"`
}
BuildApp defines a buildable application
type BuildConfig ¶
type BuildConfig struct {
OutputDir string `yaml:"output_dir"`
CmdDir string `yaml:"cmd_dir"` // Single-module only
AutoDiscover bool `yaml:"auto_discover"` // Multi-module only
Apps []BuildApp `yaml:"apps"`
Platforms []Platform `yaml:"platforms"`
LDFlags string `yaml:"ldflags"`
Tags []string `yaml:"tags"`
}
BuildConfig defines build configuration
type ConnectionConfig ¶
type ConnectionConfig struct {
URL string `yaml:"url"`
MaxConnections int `yaml:"max_connections"`
MaxIdle int `yaml:"max_idle"`
}
ConnectionConfig defines database connection settings
type DatabaseCodegenConfig ¶
type DatabaseCodegenConfig struct {
Enabled bool `yaml:"enabled"`
Output string `yaml:"output"`
Templates string `yaml:"templates"`
}
DatabaseCodegenConfig for database model generation
type DatabaseConfig ¶
type DatabaseConfig struct {
Driver string `yaml:"driver"` // postgres, mysql, sqlite
MigrationsPath string `yaml:"migrations_path"`
SeedsPath string `yaml:"seeds_path"`
ModelsOutput string `yaml:"models_output"`
Codegen DatabaseCodegenConfig `yaml:"codegen"`
Connections map[string]ConnectionConfig `yaml:"connections"`
}
DatabaseConfig defines database configuration
type DeployConfig ¶
type DeployConfig struct {
Registry string `yaml:"registry"`
Docker DockerConfig `yaml:"docker"`
Kubernetes KubernetesConfig `yaml:"kubernetes"`
Environments []EnvironmentConfig `yaml:"environments"`
}
DeployConfig defines deployment configuration
type DevConfig ¶
type DevConfig struct {
AutoDiscover bool `yaml:"auto_discover"`
DiscoverPattern string `yaml:"discover_pattern"`
DefaultApp string `yaml:"default_app"`
Watch WatchConfig `yaml:"watch"`
HotReload HotReloadConfig `yaml:"hot_reload"`
}
DevConfig defines development server configuration
type DockerConfig ¶
type DockerConfig struct {
BuildContext string `yaml:"build_context"`
Dockerfile string `yaml:"dockerfile"`
}
DockerConfig for Docker deployment
type EnvironmentConfig ¶
type EnvironmentConfig struct {
Name string `yaml:"name"`
Cluster string `yaml:"cluster"`
Namespace string `yaml:"namespace"`
}
EnvironmentConfig defines deployment environment
type ForgeConfig ¶
type ForgeConfig struct {
Project ProjectConfig `yaml:"project"`
Dev DevConfig `yaml:"dev"`
Database DatabaseConfig `yaml:"database"`
Build BuildConfig `yaml:"build"`
Deploy DeployConfig `yaml:"deploy"`
Generate GenerateConfig `yaml:"generate"`
Extensions map[string]interface{} `yaml:"extensions"`
Test TestConfig `yaml:"test"`
// Internal fields
RootDir string `yaml:"-"` // Directory containing .forge.yaml
ConfigPath string `yaml:"-"` // Full path to .forge.yaml
}
ForgeConfig represents the complete .forge.yaml configuration
func DefaultConfig ¶
func DefaultConfig() *ForgeConfig
DefaultConfig returns a default configuration
func LoadForgeConfig ¶
func LoadForgeConfig() (*ForgeConfig, string, error)
LoadForgeConfig searches for .forge.yaml up the directory tree and loads it Returns the config, the path where it was found, and any error
func (*ForgeConfig) IsMultiModule ¶
func (c *ForgeConfig) IsMultiModule() bool
IsMultiModule returns true if the project uses multi-module layout
func (*ForgeConfig) IsSingleModule ¶
func (c *ForgeConfig) IsSingleModule() bool
IsSingleModule returns true if the project uses single-module layout
type GenerateConfig ¶
type GenerateConfig struct {
TemplatesPath string `yaml:"templates_path"`
Generators map[string]GeneratorConfig `yaml:"generators"`
}
GenerateConfig defines code generation configuration
type GeneratorConfig ¶
type GeneratorConfig struct {
Output string `yaml:"output"`
CmdPath string `yaml:"cmd_path"` // Single-module
InternalPath string `yaml:"internal_path"` // Single-module
CreateModule bool `yaml:"create_module"` // Multi-module
ModulePath string `yaml:"module_path"` // Multi-module
}
GeneratorConfig defines a specific generator
type HotReloadConfig ¶
HotReloadConfig defines hot reload configuration
type KubernetesConfig ¶
type KubernetesConfig struct {
Manifests string `yaml:"manifests"`
Namespace string `yaml:"namespace"`
}
KubernetesConfig for Kubernetes deployment
type ProjectConfig ¶
type ProjectConfig struct {
Name string `yaml:"name"`
Version string `yaml:"version"`
Description string `yaml:"description"`
Type string `yaml:"type"` // monorepo, app, service, extension, cli
Layout string `yaml:"layout"` // single-module, multi-module
Module string `yaml:"module"` // For single-module layout
Workspace WorkspaceConfig `yaml:"workspace"` // For multi-module layout
Structure StructureConfig `yaml:"structure"` // For single-module layout
}
ProjectConfig defines project metadata and structure
type StructureConfig ¶
type StructureConfig struct {
Cmd string `yaml:"cmd"` // Path to cmd/
Apps string `yaml:"apps"` // Path to apps/
Pkg string `yaml:"pkg"` // Path to pkg/
Internal string `yaml:"internal"` // Path to internal/
Extensions string `yaml:"extensions"` // Path to extensions/
Database string `yaml:"database"` // Path to database/
Config string `yaml:"config"` // Path to config/
Deployments string `yaml:"deployments"` // Path to deployments/
}
StructureConfig for single-module layout
type TestConfig ¶
type TestConfig struct {
CoverageThreshold int `yaml:"coverage_threshold"`
RaceDetector bool `yaml:"race_detector"`
Parallel bool `yaml:"parallel"`
Timeout time.Duration `yaml:"timeout"`
}
TestConfig defines testing configuration
type WatchConfig ¶
type WatchConfig struct {
Enabled bool `yaml:"enabled"`
Paths []string `yaml:"paths"`
Exclude []string `yaml:"exclude"`
}
WatchConfig defines file watching configuration
type WorkspaceConfig ¶
type WorkspaceConfig struct {
Enabled bool `yaml:"enabled"`
Apps string `yaml:"apps"` // Glob pattern: "./apps/*"
Services string `yaml:"services"` // Glob pattern: "./services/*"
Extensions string `yaml:"extensions"` // Glob pattern: "./extensions/*"
Pkg string `yaml:"pkg"` // Path: "./pkg"
}
WorkspaceConfig for multi-module layout