2025-09-22 22:11:41 +00:00
|
|
|
#!/usr/bin/env -S nu
|
feat: Complete config-driven architecture migration v2.0.0
Transform provisioning system from ENV-based to hierarchical config-driven architecture.
This represents a complete system redesign with breaking changes requiring migration.
## Migration Summary
- 65+ files migrated across entire codebase
- 200+ ENV variables replaced with 476 config accessors
- 29 syntax errors fixed across 17 files
- 92% token efficiency maintained during migration
## Core Features Added
### Hierarchical Configuration System
- 6-layer precedence: defaults → user → project → infra → env → runtime
- Deep merge strategy with intelligent precedence rules
- Multi-environment support (dev/test/prod) with auto-detection
- Configuration templates for all environments
### Enhanced Interpolation Engine
- Dynamic variables: {{paths.base}}, {{env.HOME}}, {{now.date}}
- Git context: {{git.branch}}, {{git.commit}}, {{git.remote}}
- SOPS integration: {{sops.decrypt()}} for secrets management
- Path operations: {{path.join()}} for dynamic construction
- Security: circular dependency detection, injection prevention
### Comprehensive Validation
- Structure, path, type, semantic, and security validation
- Code injection and path traversal detection
- Detailed error reporting with actionable messages
- Configuration health checks and warnings
## Architecture Changes
### Configuration Management (core/nulib/lib_provisioning/config/)
- loader.nu: 1600+ line hierarchical config loader with validation
- accessor.nu: 476 config accessor functions replacing ENV vars
### Provider System (providers/)
- AWS, UpCloud, Local providers fully config-driven
- Unified middleware system with standardized interfaces
### Task Services (core/nulib/taskservs/)
- Kubernetes, storage, networking, registry services migrated
- Template-driven configuration generation
### Cluster Management (core/nulib/clusters/)
- Complete lifecycle management through configuration
- Environment-specific cluster templates
## New Configuration Files
- config.defaults.toml: System defaults (84 lines)
- config.*.toml.example: Environment templates (400+ lines each)
- Enhanced CLI: validate, env, multi-environment support
## Security Enhancements
- Type-safe configuration access through validated functions
- SOPS integration for encrypted secrets management
- Input validation preventing injection attacks
- Environment isolation and access controls
## Breaking Changes
⚠️ ENV variables no longer supported as primary configuration
⚠️ Function signatures require --config parameter
⚠️ CLI arguments and return types modified
⚠️ Provider authentication now config-driven
## Migration Path
1. Backup current environment variables
2. Copy config.user.toml.example → config.user.toml
3. Migrate ENV vars to TOML format
4. Validate: ./core/nulib/provisioning validate config
5. Test functionality with new configuration
## Validation Results
✅ Structure valid
✅ Paths valid
✅ Types valid
✅ Semantic rules valid
✅ File references valid
System ready for production use with config-driven architecture.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-23 02:36:50 +00:00
|
|
|
# Author: JesusPerezLorenzo
|
2025-09-22 22:11:41 +00:00
|
|
|
# Release: 1.0.4
|
|
|
|
# Date: 6-2-2024
|
|
|
|
|
feat: Complete config-driven architecture migration v2.0.0
Transform provisioning system from ENV-based to hierarchical config-driven architecture.
This represents a complete system redesign with breaking changes requiring migration.
## Migration Summary
- 65+ files migrated across entire codebase
- 200+ ENV variables replaced with 476 config accessors
- 29 syntax errors fixed across 17 files
- 92% token efficiency maintained during migration
## Core Features Added
### Hierarchical Configuration System
- 6-layer precedence: defaults → user → project → infra → env → runtime
- Deep merge strategy with intelligent precedence rules
- Multi-environment support (dev/test/prod) with auto-detection
- Configuration templates for all environments
### Enhanced Interpolation Engine
- Dynamic variables: {{paths.base}}, {{env.HOME}}, {{now.date}}
- Git context: {{git.branch}}, {{git.commit}}, {{git.remote}}
- SOPS integration: {{sops.decrypt()}} for secrets management
- Path operations: {{path.join()}} for dynamic construction
- Security: circular dependency detection, injection prevention
### Comprehensive Validation
- Structure, path, type, semantic, and security validation
- Code injection and path traversal detection
- Detailed error reporting with actionable messages
- Configuration health checks and warnings
## Architecture Changes
### Configuration Management (core/nulib/lib_provisioning/config/)
- loader.nu: 1600+ line hierarchical config loader with validation
- accessor.nu: 476 config accessor functions replacing ENV vars
### Provider System (providers/)
- AWS, UpCloud, Local providers fully config-driven
- Unified middleware system with standardized interfaces
### Task Services (core/nulib/taskservs/)
- Kubernetes, storage, networking, registry services migrated
- Template-driven configuration generation
### Cluster Management (core/nulib/clusters/)
- Complete lifecycle management through configuration
- Environment-specific cluster templates
## New Configuration Files
- config.defaults.toml: System defaults (84 lines)
- config.*.toml.example: Environment templates (400+ lines each)
- Enhanced CLI: validate, env, multi-environment support
## Security Enhancements
- Type-safe configuration access through validated functions
- SOPS integration for encrypted secrets management
- Input validation preventing injection attacks
- Environment isolation and access controls
## Breaking Changes
⚠️ ENV variables no longer supported as primary configuration
⚠️ Function signatures require --config parameter
⚠️ CLI arguments and return types modified
⚠️ Provider authentication now config-driven
## Migration Path
1. Backup current environment variables
2. Copy config.user.toml.example → config.user.toml
3. Migrate ENV vars to TOML format
4. Validate: ./core/nulib/provisioning validate config
5. Test functionality with new configuration
## Validation Results
✅ Structure valid
✅ Paths valid
✅ Types valid
✅ Semantic rules valid
✅ File references valid
System ready for production use with config-driven architecture.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-23 02:36:50 +00:00
|
|
|
use ../config/accessor.nu *
|
|
|
|
|
2025-09-22 22:11:41 +00:00
|
|
|
#use ../lib_provisioning/utils/templates.nu on_template_path
|
|
|
|
|
|
|
|
export def github_latest_tag [
|
|
|
|
url: string = ""
|
|
|
|
use_dev_release: bool = false
|
|
|
|
id_target: string = "releases/tag"
|
|
|
|
]: nothing -> string {
|
|
|
|
#let res = (http get $url -r )
|
|
|
|
if ($url | is-empty) { return "" }
|
|
|
|
let res = (^curl -s $url | complete)
|
|
|
|
let html_content = if ($res.exit_code != 0) {
|
|
|
|
print $"🛑 Error (_ansi red)($url)(_ansi reset):\n ($res.exit_code) ($res.stderr)"
|
|
|
|
return ""
|
|
|
|
} else { $res.stdout }
|
|
|
|
# curl -s https://github.com/project-zot/zot/tags | grep "<h2 " | grep "releases/tag"
|
|
|
|
let versions = ($html_content | parse --regex '<h2 (?<a>.*?)</a>' | get -o a | each {|it|
|
|
|
|
($it | parse --regex ($"($id_target)" + '/(?<version>.*?)"') | get version | get -o 0 | default "")
|
|
|
|
})
|
|
|
|
let list = if $use_dev_release {
|
|
|
|
$versions
|
|
|
|
} else {
|
|
|
|
($versions | where {|it|
|
|
|
|
not ($it | str contains "-rc") and not ($it | str contains "-alpha")
|
|
|
|
})
|
|
|
|
}
|
|
|
|
$list | sort -r | get -o 0 | default ""
|
|
|
|
}
|
|
|
|
|
|
|
|
export def value_input_list [
|
|
|
|
input_type: string
|
|
|
|
options_list: list
|
|
|
|
msg: string
|
|
|
|
default_value: string
|
|
|
|
]: nothing -> string {
|
|
|
|
let selection_pos = ( $options_list
|
|
|
|
| input list --index (
|
|
|
|
$"(_ansi default_dimmed)Select(_ansi reset) (_ansi yellow_bold)($msg)(_ansi reset) " +
|
|
|
|
$"\n(_ansi default_dimmed)\(use arrow keys and press [enter] or [escape] for default '(_ansi reset)" +
|
|
|
|
$"($default_value)(_ansi default_dimmed)'\)(_ansi reset)"
|
|
|
|
))
|
|
|
|
if $selection_pos != null {
|
|
|
|
($options_list | get -o $selection_pos | default $default_value)
|
|
|
|
} else { $default_value }
|
|
|
|
}
|
|
|
|
|
|
|
|
export def value_input [
|
|
|
|
input_type: string
|
|
|
|
numchar: int
|
|
|
|
msg: string
|
|
|
|
default_value: string
|
|
|
|
not_empty: bool
|
|
|
|
]: nothing -> string {
|
|
|
|
while true {
|
|
|
|
let value_input = if $numchar > 0 {
|
|
|
|
print ($"(_ansi yellow_bold)($msg)(_ansi reset) " +
|
|
|
|
$"(_ansi default_dimmed) type value (_ansi green_bold)($numchar) chars(_ansi reset) " +
|
|
|
|
$"(_ansi default_dimmed) default '(_ansi reset)" +
|
|
|
|
$"($default_value)(_ansi default_dimmed)'(_ansi reset)"
|
|
|
|
)
|
|
|
|
(input --numchar $numchar)
|
|
|
|
} else {
|
|
|
|
print ($"(_ansi yellow_bold)($msg)(_ansi reset) " +
|
|
|
|
$"(_ansi default_dimmed)\(type value and press [enter] default '(_ansi reset)" +
|
|
|
|
$"($default_value)(_ansi default_dimmed)'\)(_ansi reset)"
|
|
|
|
)
|
|
|
|
(input)
|
|
|
|
}
|
|
|
|
if $not_empty and ($value_input | is-empty) {
|
|
|
|
if ($default_value | is-not-empty) { return $default_value }
|
|
|
|
continue
|
|
|
|
} else if ($value_input | is-empty) {
|
|
|
|
return $default_value
|
|
|
|
}
|
|
|
|
let result = match $input_type {
|
|
|
|
"number" => {
|
|
|
|
if ($value_input | parse --regex '^[0-9]' | length) > 0 { $value_input } else { "" }
|
|
|
|
},
|
|
|
|
"ipv4-address" => {
|
|
|
|
if ($value_input | parse --regex '^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$' | length) > 0 { $value_input } else { "" }
|
|
|
|
},
|
|
|
|
_ => $value_input,
|
|
|
|
}
|
|
|
|
if $value_input != $result { continue }
|
|
|
|
return $value_input
|
|
|
|
}
|
|
|
|
return $default_value
|
|
|
|
}
|
|
|
|
|
|
|
|
export def "generate_title" [
|
|
|
|
title: string
|
|
|
|
]: nothing -> nothing {
|
feat: Complete config-driven architecture migration v2.0.0
Transform provisioning system from ENV-based to hierarchical config-driven architecture.
This represents a complete system redesign with breaking changes requiring migration.
## Migration Summary
- 65+ files migrated across entire codebase
- 200+ ENV variables replaced with 476 config accessors
- 29 syntax errors fixed across 17 files
- 92% token efficiency maintained during migration
## Core Features Added
### Hierarchical Configuration System
- 6-layer precedence: defaults → user → project → infra → env → runtime
- Deep merge strategy with intelligent precedence rules
- Multi-environment support (dev/test/prod) with auto-detection
- Configuration templates for all environments
### Enhanced Interpolation Engine
- Dynamic variables: {{paths.base}}, {{env.HOME}}, {{now.date}}
- Git context: {{git.branch}}, {{git.commit}}, {{git.remote}}
- SOPS integration: {{sops.decrypt()}} for secrets management
- Path operations: {{path.join()}} for dynamic construction
- Security: circular dependency detection, injection prevention
### Comprehensive Validation
- Structure, path, type, semantic, and security validation
- Code injection and path traversal detection
- Detailed error reporting with actionable messages
- Configuration health checks and warnings
## Architecture Changes
### Configuration Management (core/nulib/lib_provisioning/config/)
- loader.nu: 1600+ line hierarchical config loader with validation
- accessor.nu: 476 config accessor functions replacing ENV vars
### Provider System (providers/)
- AWS, UpCloud, Local providers fully config-driven
- Unified middleware system with standardized interfaces
### Task Services (core/nulib/taskservs/)
- Kubernetes, storage, networking, registry services migrated
- Template-driven configuration generation
### Cluster Management (core/nulib/clusters/)
- Complete lifecycle management through configuration
- Environment-specific cluster templates
## New Configuration Files
- config.defaults.toml: System defaults (84 lines)
- config.*.toml.example: Environment templates (400+ lines each)
- Enhanced CLI: validate, env, multi-environment support
## Security Enhancements
- Type-safe configuration access through validated functions
- SOPS integration for encrypted secrets management
- Input validation preventing injection attacks
- Environment isolation and access controls
## Breaking Changes
⚠️ ENV variables no longer supported as primary configuration
⚠️ Function signatures require --config parameter
⚠️ CLI arguments and return types modified
⚠️ Provider authentication now config-driven
## Migration Path
1. Backup current environment variables
2. Copy config.user.toml.example → config.user.toml
3. Migrate ENV vars to TOML format
4. Validate: ./core/nulib/provisioning validate config
5. Test functionality with new configuration
## Validation Results
✅ Structure valid
✅ Paths valid
✅ Types valid
✅ Semantic rules valid
✅ File references valid
System ready for production use with config-driven architecture.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-23 02:36:50 +00:00
|
|
|
_print $"\n(_ansi purple)((get-provisioning-name))(_ansi reset) (_ansi default_dimmed)generate:(_ansi reset) (_ansi cyan)($title)(_ansi reset)"
|
2025-09-22 22:11:41 +00:00
|
|
|
_print $"(_ansi default_dimmed)-------------------------------------------------------------(_ansi reset)\n"
|
|
|
|
}
|
|
|
|
|
|
|
|
export def "generate_data_items" [
|
|
|
|
defs_gen: list = []
|
|
|
|
defs_values: list = []
|
|
|
|
]: nothing -> record {
|
|
|
|
mut data = {}
|
|
|
|
for it in $defs_values {
|
|
|
|
let input_type = ($it | get -o input_type | default "")
|
|
|
|
let options_list = ($it | get -o options_list | default [])
|
|
|
|
let numchar = ($it | get -o numchar | default 0)
|
|
|
|
let msg = ($it | get -o msg | default "")
|
|
|
|
let default_value = match $input_type {
|
|
|
|
"list-record" | "list" => ($it | get -o default_value | default []),
|
|
|
|
"record" => ($it | get -o default_value | default {}),
|
|
|
|
_ => ($it | get -o default_value | default ""),
|
|
|
|
}
|
|
|
|
let var = ($it | get -o var | default "")
|
|
|
|
let not_empty = ($it | get -o not_empty | default false)
|
|
|
|
print $input_type
|
|
|
|
let value = match $input_type {
|
|
|
|
"record" => (generate_data_items $it),
|
|
|
|
"list-record" => {
|
|
|
|
let record_key = ($it | get -o record | default "")
|
|
|
|
let record_value = ($defs_gen | get -o $record_key | default [])
|
|
|
|
print ($record_value | table -e)
|
|
|
|
# where {|it| ($it | get -o $record_key | is-not-empty)} | get -o 0 | get -o $record_key | default [])
|
|
|
|
if ($record_value | is-empty) { continue }
|
|
|
|
mut val = []
|
|
|
|
while true {
|
|
|
|
let selection_pos = ( [ $"Add ($msg)", $"No more ($var)" ]
|
|
|
|
| input list --index (
|
|
|
|
$"(_ansi default_dimmed)Select(_ansi reset) (_ansi yellow_bold)($msg)(_ansi reset) " +
|
|
|
|
$"\n(_ansi default_dimmed)\(use arrow keys and press [enter] or [escape] to finish '(_ansi reset)"
|
|
|
|
))
|
|
|
|
if $selection_pos == null or $selection_pos == 1 { break }
|
|
|
|
$val = ($val | append (generate_data_items $defs_gen $record_value))
|
|
|
|
}
|
|
|
|
$val
|
|
|
|
},
|
|
|
|
"list" => (value_input_list $input_type $options_list $msg $default_value),
|
|
|
|
_ => (value_input $input_type $numchar $msg $default_value $not_empty),
|
|
|
|
}
|
|
|
|
$data = ($data | merge { $var: $value })
|
|
|
|
}
|
|
|
|
$data
|
|
|
|
}
|
|
|
|
|
|
|
|
export def "generate_data_def" [
|
|
|
|
root_path: string
|
|
|
|
infra_name: string
|
|
|
|
infra_path: string
|
|
|
|
created: bool
|
|
|
|
inputfile: string = ""
|
|
|
|
]: nothing -> nothing {
|
|
|
|
let data = (if ($inputfile | is-empty) {
|
feat: Complete config-driven architecture migration v2.0.0
Transform provisioning system from ENV-based to hierarchical config-driven architecture.
This represents a complete system redesign with breaking changes requiring migration.
## Migration Summary
- 65+ files migrated across entire codebase
- 200+ ENV variables replaced with 476 config accessors
- 29 syntax errors fixed across 17 files
- 92% token efficiency maintained during migration
## Core Features Added
### Hierarchical Configuration System
- 6-layer precedence: defaults → user → project → infra → env → runtime
- Deep merge strategy with intelligent precedence rules
- Multi-environment support (dev/test/prod) with auto-detection
- Configuration templates for all environments
### Enhanced Interpolation Engine
- Dynamic variables: {{paths.base}}, {{env.HOME}}, {{now.date}}
- Git context: {{git.branch}}, {{git.commit}}, {{git.remote}}
- SOPS integration: {{sops.decrypt()}} for secrets management
- Path operations: {{path.join()}} for dynamic construction
- Security: circular dependency detection, injection prevention
### Comprehensive Validation
- Structure, path, type, semantic, and security validation
- Code injection and path traversal detection
- Detailed error reporting with actionable messages
- Configuration health checks and warnings
## Architecture Changes
### Configuration Management (core/nulib/lib_provisioning/config/)
- loader.nu: 1600+ line hierarchical config loader with validation
- accessor.nu: 476 config accessor functions replacing ENV vars
### Provider System (providers/)
- AWS, UpCloud, Local providers fully config-driven
- Unified middleware system with standardized interfaces
### Task Services (core/nulib/taskservs/)
- Kubernetes, storage, networking, registry services migrated
- Template-driven configuration generation
### Cluster Management (core/nulib/clusters/)
- Complete lifecycle management through configuration
- Environment-specific cluster templates
## New Configuration Files
- config.defaults.toml: System defaults (84 lines)
- config.*.toml.example: Environment templates (400+ lines each)
- Enhanced CLI: validate, env, multi-environment support
## Security Enhancements
- Type-safe configuration access through validated functions
- SOPS integration for encrypted secrets management
- Input validation preventing injection attacks
- Environment isolation and access controls
## Breaking Changes
⚠️ ENV variables no longer supported as primary configuration
⚠️ Function signatures require --config parameter
⚠️ CLI arguments and return types modified
⚠️ Provider authentication now config-driven
## Migration Path
1. Backup current environment variables
2. Copy config.user.toml.example → config.user.toml
3. Migrate ENV vars to TOML format
4. Validate: ./core/nulib/provisioning validate config
5. Test functionality with new configuration
## Validation Results
✅ Structure valid
✅ Paths valid
✅ Types valid
✅ Semantic rules valid
✅ File references valid
System ready for production use with config-driven architecture.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-23 02:36:50 +00:00
|
|
|
let defs_path = ($root_path | path join (get-provisioning-generate-dirpath) | path join (get-provisioning-generate-defsfile))
|
2025-09-22 22:11:41 +00:00
|
|
|
if ( $defs_path | path exists) {
|
|
|
|
let data_gen = (open $defs_path)
|
|
|
|
let title = $"($data_gen| get -o title | default "")"
|
|
|
|
generate_title $title
|
|
|
|
let defs_values = ($data_gen | get -o defs_values | default [])
|
|
|
|
(generate_data_items $data_gen $defs_values)
|
|
|
|
} else {
|
feat: Complete config-driven architecture migration v2.0.0
Transform provisioning system from ENV-based to hierarchical config-driven architecture.
This represents a complete system redesign with breaking changes requiring migration.
## Migration Summary
- 65+ files migrated across entire codebase
- 200+ ENV variables replaced with 476 config accessors
- 29 syntax errors fixed across 17 files
- 92% token efficiency maintained during migration
## Core Features Added
### Hierarchical Configuration System
- 6-layer precedence: defaults → user → project → infra → env → runtime
- Deep merge strategy with intelligent precedence rules
- Multi-environment support (dev/test/prod) with auto-detection
- Configuration templates for all environments
### Enhanced Interpolation Engine
- Dynamic variables: {{paths.base}}, {{env.HOME}}, {{now.date}}
- Git context: {{git.branch}}, {{git.commit}}, {{git.remote}}
- SOPS integration: {{sops.decrypt()}} for secrets management
- Path operations: {{path.join()}} for dynamic construction
- Security: circular dependency detection, injection prevention
### Comprehensive Validation
- Structure, path, type, semantic, and security validation
- Code injection and path traversal detection
- Detailed error reporting with actionable messages
- Configuration health checks and warnings
## Architecture Changes
### Configuration Management (core/nulib/lib_provisioning/config/)
- loader.nu: 1600+ line hierarchical config loader with validation
- accessor.nu: 476 config accessor functions replacing ENV vars
### Provider System (providers/)
- AWS, UpCloud, Local providers fully config-driven
- Unified middleware system with standardized interfaces
### Task Services (core/nulib/taskservs/)
- Kubernetes, storage, networking, registry services migrated
- Template-driven configuration generation
### Cluster Management (core/nulib/clusters/)
- Complete lifecycle management through configuration
- Environment-specific cluster templates
## New Configuration Files
- config.defaults.toml: System defaults (84 lines)
- config.*.toml.example: Environment templates (400+ lines each)
- Enhanced CLI: validate, env, multi-environment support
## Security Enhancements
- Type-safe configuration access through validated functions
- SOPS integration for encrypted secrets management
- Input validation preventing injection attacks
- Environment isolation and access controls
## Breaking Changes
⚠️ ENV variables no longer supported as primary configuration
⚠️ Function signatures require --config parameter
⚠️ CLI arguments and return types modified
⚠️ Provider authentication now config-driven
## Migration Path
1. Backup current environment variables
2. Copy config.user.toml.example → config.user.toml
3. Migrate ENV vars to TOML format
4. Validate: ./core/nulib/provisioning validate config
5. Test functionality with new configuration
## Validation Results
✅ Structure valid
✅ Paths valid
✅ Types valid
✅ Semantic rules valid
✅ File references valid
System ready for production use with config-driven architecture.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-23 02:36:50 +00:00
|
|
|
if (is-debug-enabled) { _print $"🛑 ((get-provisioning-name)) generate: Invalid path (_ansi red)($defs_path)(_ansi reset)" }
|
2025-09-22 22:11:41 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
(open $inputfile)
|
|
|
|
} | merge {
|
|
|
|
infra_name: $infra_name,
|
|
|
|
infra_path: $infra_path,
|
|
|
|
})
|
|
|
|
let vars_filepath = $"/tmp/data_($infra_name)_($env.NOW).yaml"
|
|
|
|
($data | to yaml | str replace "$name" $infra_name| save -f $vars_filepath)
|
feat: Complete config-driven architecture migration v2.0.0
Transform provisioning system from ENV-based to hierarchical config-driven architecture.
This represents a complete system redesign with breaking changes requiring migration.
## Migration Summary
- 65+ files migrated across entire codebase
- 200+ ENV variables replaced with 476 config accessors
- 29 syntax errors fixed across 17 files
- 92% token efficiency maintained during migration
## Core Features Added
### Hierarchical Configuration System
- 6-layer precedence: defaults → user → project → infra → env → runtime
- Deep merge strategy with intelligent precedence rules
- Multi-environment support (dev/test/prod) with auto-detection
- Configuration templates for all environments
### Enhanced Interpolation Engine
- Dynamic variables: {{paths.base}}, {{env.HOME}}, {{now.date}}
- Git context: {{git.branch}}, {{git.commit}}, {{git.remote}}
- SOPS integration: {{sops.decrypt()}} for secrets management
- Path operations: {{path.join()}} for dynamic construction
- Security: circular dependency detection, injection prevention
### Comprehensive Validation
- Structure, path, type, semantic, and security validation
- Code injection and path traversal detection
- Detailed error reporting with actionable messages
- Configuration health checks and warnings
## Architecture Changes
### Configuration Management (core/nulib/lib_provisioning/config/)
- loader.nu: 1600+ line hierarchical config loader with validation
- accessor.nu: 476 config accessor functions replacing ENV vars
### Provider System (providers/)
- AWS, UpCloud, Local providers fully config-driven
- Unified middleware system with standardized interfaces
### Task Services (core/nulib/taskservs/)
- Kubernetes, storage, networking, registry services migrated
- Template-driven configuration generation
### Cluster Management (core/nulib/clusters/)
- Complete lifecycle management through configuration
- Environment-specific cluster templates
## New Configuration Files
- config.defaults.toml: System defaults (84 lines)
- config.*.toml.example: Environment templates (400+ lines each)
- Enhanced CLI: validate, env, multi-environment support
## Security Enhancements
- Type-safe configuration access through validated functions
- SOPS integration for encrypted secrets management
- Input validation preventing injection attacks
- Environment isolation and access controls
## Breaking Changes
⚠️ ENV variables no longer supported as primary configuration
⚠️ Function signatures require --config parameter
⚠️ CLI arguments and return types modified
⚠️ Provider authentication now config-driven
## Migration Path
1. Backup current environment variables
2. Copy config.user.toml.example → config.user.toml
3. Migrate ENV vars to TOML format
4. Validate: ./core/nulib/provisioning validate config
5. Test functionality with new configuration
## Validation Results
✅ Structure valid
✅ Paths valid
✅ Types valid
✅ Semantic rules valid
✅ File references valid
System ready for production use with config-driven architecture.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-23 02:36:50 +00:00
|
|
|
let remove_files = if (is-debug-enabled) { false } else { true }
|
2025-09-22 22:11:41 +00:00
|
|
|
on_template_path $infra_path $vars_filepath $remove_files true
|
feat: Complete config-driven architecture migration v2.0.0
Transform provisioning system from ENV-based to hierarchical config-driven architecture.
This represents a complete system redesign with breaking changes requiring migration.
## Migration Summary
- 65+ files migrated across entire codebase
- 200+ ENV variables replaced with 476 config accessors
- 29 syntax errors fixed across 17 files
- 92% token efficiency maintained during migration
## Core Features Added
### Hierarchical Configuration System
- 6-layer precedence: defaults → user → project → infra → env → runtime
- Deep merge strategy with intelligent precedence rules
- Multi-environment support (dev/test/prod) with auto-detection
- Configuration templates for all environments
### Enhanced Interpolation Engine
- Dynamic variables: {{paths.base}}, {{env.HOME}}, {{now.date}}
- Git context: {{git.branch}}, {{git.commit}}, {{git.remote}}
- SOPS integration: {{sops.decrypt()}} for secrets management
- Path operations: {{path.join()}} for dynamic construction
- Security: circular dependency detection, injection prevention
### Comprehensive Validation
- Structure, path, type, semantic, and security validation
- Code injection and path traversal detection
- Detailed error reporting with actionable messages
- Configuration health checks and warnings
## Architecture Changes
### Configuration Management (core/nulib/lib_provisioning/config/)
- loader.nu: 1600+ line hierarchical config loader with validation
- accessor.nu: 476 config accessor functions replacing ENV vars
### Provider System (providers/)
- AWS, UpCloud, Local providers fully config-driven
- Unified middleware system with standardized interfaces
### Task Services (core/nulib/taskservs/)
- Kubernetes, storage, networking, registry services migrated
- Template-driven configuration generation
### Cluster Management (core/nulib/clusters/)
- Complete lifecycle management through configuration
- Environment-specific cluster templates
## New Configuration Files
- config.defaults.toml: System defaults (84 lines)
- config.*.toml.example: Environment templates (400+ lines each)
- Enhanced CLI: validate, env, multi-environment support
## Security Enhancements
- Type-safe configuration access through validated functions
- SOPS integration for encrypted secrets management
- Input validation preventing injection attacks
- Environment isolation and access controls
## Breaking Changes
⚠️ ENV variables no longer supported as primary configuration
⚠️ Function signatures require --config parameter
⚠️ CLI arguments and return types modified
⚠️ Provider authentication now config-driven
## Migration Path
1. Backup current environment variables
2. Copy config.user.toml.example → config.user.toml
3. Migrate ENV vars to TOML format
4. Validate: ./core/nulib/provisioning validate config
5. Test functionality with new configuration
## Validation Results
✅ Structure valid
✅ Paths valid
✅ Types valid
✅ Semantic rules valid
✅ File references valid
System ready for production use with config-driven architecture.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-23 02:36:50 +00:00
|
|
|
if not (is-debug-enabled) {
|
2025-09-22 22:11:41 +00:00
|
|
|
rm -f $vars_filepath
|
|
|
|
}
|
|
|
|
}
|