Skip to content

Commit 012a518

Browse files
authored
Merge pull request #21 from open-edge-platform/global-config
Add Global Configuration System
2 parents 1f22156 + 2476f64 commit 012a518

7 files changed

Lines changed: 544 additions & 129 deletions

File tree

README.md

Lines changed: 70 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,53 @@ The Earthly build automatically includes:
4242
- Build date (current UTC date)
4343
- Git commit SHA (current repository commit)
4444

45+
## Configuration
46+
47+
### Global Configuration
48+
49+
Image Composer Tool supports global configuration files to set tool-level parameters that apply across all image builds. Image-specific parameters should still be defined in the JSON specification files.
50+
51+
#### Configuration File Locations
52+
53+
The tool searches for configuration files in the following order:
54+
55+
1. `image-composer.yaml` (current directory)
56+
2. `image-composer.yml` (current directory)
57+
3. `.image-composer.yaml` (hidden file in current directory)
58+
4. `~/.image-composer/config.yaml` (user home directory)
59+
5. `~/.config/image-composer/config.yaml` (XDG config directory)
60+
6. `/etc/image-composer/config.yaml` (system-wide)
61+
62+
#### Configuration Parameters
63+
64+
```yaml
65+
# Core tool settings
66+
workers: 12 # Number of concurrent download workers (1-100, default: 8)
67+
cache_dir: "/var/cache/image-composer" # Package cache directory (default: ./cache)
68+
work_dir: "/tmp/image-composer" # Working directory for builds (default: ./workspace)
69+
temp_dir: "" # Temporary directory (empty = system default)
70+
71+
# Logging configuration
72+
logging:
73+
level: "info" # Log level: debug, info, warn, error (default: info)
74+
```
75+
76+
#### Configuration Management Commands
77+
78+
```bash
79+
# Create a new configuration file
80+
./image-composer config init
81+
82+
# Create config file at specific location
83+
./image-composer config init /path/to/config.yaml
84+
85+
# Show current configuration
86+
./image-composer config show
87+
88+
# Use specific configuration file
89+
./image-composer --config /path/to/config.yaml build spec.json
90+
```
91+
4592
### Usage
4693

4794
The Image Composer Tool uses a command-line interface with various commands:
@@ -53,6 +100,9 @@ The Image Composer Tool uses a command-line interface with various commands:
53100
# Build command with spec file as positional argument
54101
./image-composer build testdata/valid.json
55102

103+
# Override config settings with command-line flags
104+
./image-composer build --workers 16 --cache-dir /tmp/cache testdata/valid.json
105+
56106
# Validate a spec file against the schema
57107
./image-composer validate testdata/valid.json
58108

@@ -77,17 +127,32 @@ Builds a Linux distribution image based on the specified spec file:
77127

78128
Flags:
79129

80-
- `--workers, -w`: Number of concurrent download workers (default: 8)
81-
- `--cache-dir, -d`: Package cache directory (default: "./downloads")
130+
- `--workers, -w`: Number of concurrent download workers (overrides config file)
131+
- `--cache-dir, -d`: Package cache directory (overrides config file)
132+
- `--work-dir`: Working directory for builds (overrides config file)
82133
- `--verbose, -v`: Enable verbose output
83-
- `--dotfile, -f': Generate dependency graph as a dot file
134+
- `--dotfile, -f`: Generate dependency graph as a dot file
135+
- `--config`: Path to configuration file
136+
- `--log-level`: Log level (debug, info, warn, error)
84137

85138
Example:
86139

87140
```bash
88141
./image-composer build --workers 12 --cache-dir ./package-cache testdata/valid.json
89142
```
90143

144+
#### config
145+
146+
Manages global configuration:
147+
148+
```bash
149+
# Show current configuration
150+
./image-composer config show
151+
152+
# Initialize new configuration file
153+
./image-composer config init [config-file]
154+
```
155+
91156
#### validate
92157

93158
Validates a JSON spec file against the schema without building an image:
@@ -314,11 +379,11 @@ Once completion is installed:
314379
```bash
315380
# Tab-complete commands
316381
./image-composer <TAB>
317-
build completion help validate version
382+
build completion config help validate version
318383

319384
# Tab-complete flags
320385
./image-composer build --<TAB>
321-
--cache-dir --help --verbose --workers
386+
--cache-dir --config --help --log-level --verbose --work-dir --workers
322387

323388
# Tab-complete JSON files for spec file argument
324389
./image-composer build <TAB>

0 commit comments

Comments
 (0)