grokking simplicity and refactoring
This commit is contained in:
parent
89a7fe100d
commit
fb4361d938
67 changed files with 6275 additions and 56 deletions
43
packages/lab-tool/utils/config-new.scm
Normal file
43
packages/lab-tool/utils/config-new.scm
Normal file
|
@ -0,0 +1,43 @@
|
|||
;; utils/config.scm - Configuration management facade
|
||||
|
||||
(define-module (utils config)
|
||||
#:use-module (utils config defaults)
|
||||
#:use-module (utils config loader)
|
||||
#:use-module (utils config accessor)
|
||||
#:use-module (utils config state)
|
||||
#:re-export (;; State management
|
||||
get-current-config
|
||||
set-current-config!
|
||||
reload-config!
|
||||
|
||||
;; Stateful accessors (work with current config)
|
||||
get-config-value
|
||||
get-machine-config
|
||||
get-all-machines
|
||||
get-ssh-config
|
||||
validate-machine-name
|
||||
get-homelab-root
|
||||
|
||||
;; Pure accessors (require explicit config parameter)
|
||||
get-config-value-pure
|
||||
get-machine-config-pure
|
||||
get-all-machines-pure
|
||||
get-ssh-config-pure
|
||||
validate-machine-name-pure
|
||||
|
||||
;; Loading functions
|
||||
load-config
|
||||
load-config-from-file
|
||||
|
||||
;; Default configuration
|
||||
default-config))
|
||||
|
||||
;; This module acts as a facade for configuration management,
|
||||
;; aggregating specialized modules that follow single responsibility:
|
||||
;; - defaults: Pure data definitions
|
||||
;; - loader: File I/O operations
|
||||
;; - accessor: Pure configuration value access
|
||||
;; - state: Mutable state management
|
||||
;;
|
||||
;; Both pure and impure functions are available, allowing callers
|
||||
;; to choose the appropriate level of functional purity.
|
Loading…
Add table
Add a link
Reference in a new issue