-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic.yml
More file actions
57 lines (45 loc) · 1.59 KB
/
basic.yml
File metadata and controls
57 lines (45 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
# Basic load operator examples
# Load a YAML file
databases: (( load "configs/database.yml" ))
# This loads the entire content of database.yml as structured data
# Load a JSON file
feature_flags: (( load "configs/features.json" ))
# JSON is automatically parsed into YAML structure
# Load and access specific values
app_config:
# Load the file
all_databases: (( load "configs/database.yml" ))
# Access loaded data with grab
primary_db: (( grab app_config.all_databases.postgres ))
# Or combine load with immediate access (using nested expressions)
mongodb_host: (( grab (load "configs/database.yml").mongodb.host ))
# Load multiple configuration files
redis_config:
# Load all Redis configurations
all: (( load "configs/redis.yml" ))
# Pick specific configs
cache_config: (( grab redis_config.all.cache ))
session_config: (( grab redis_config.all.sessions ))
# Loading arrays/lists
users:
# Load user data
data: (( load "data/users.yml" ))
# Access specific user groups
admin_users: (( grab users.data.admins ))
dev_users: (( grab users.data.developers ))
# Count users (would need calc operator)
# admin_count: (( calc "$( (grab users.data.admins) | len )" ))
# Important: Graft operators in loaded files are NOT evaluated
# If database.yml contained (( grab some.value )), it would be loaded as-is
# This is different from the merge behavior
# Example of what NOT to expect:
# If external.yml contains:
# value: (( grab meta.name ))
#
# Then:
# data: (( load "external.yml" ))
#
# Results in:
# data:
# value: (( grab meta.name )) # <-- NOT evaluated!