Testing flat YAML structure (tanpa root key) yang diakses menggunakan wildcard key '*'. Config ini berisi direct key-value pairs di root level dengan arrays.
Simple configuration file yang tidak memerlukan grouping, langsung berisi settings yang dibutuhkan.
ApiSecret: flat_secret_789
TrxAuthMethod: oauth2
TrxSignKey: X-Auth-Token
endpoint: https://api.example.com
retryAttempts: 3
connectionTimeout: 5000
headers:
- name: X-Api-Key
type: LITERAL
value: api_key_xyz
- name: User-Agent
value: ACE-Middleware/1.0
allowedMethods:
- GET
- POST
- PUT
- DELETE
responseFields:
- id
- status
- timestamp
- data
{
"ApiSecret": "flat_secret_789",
"TrxAuthMethod": "oauth2",
"TrxSignKey": "X-Auth-Token",
"endpoint": "https://api.example.com",
"retryAttempts": "3",
"connectionTimeout": "5000",
"headers": [
{
"name": "X-Api-Key",
"type": "LITERAL",
"value": "api_key_xyz"
},
{
"name": "User-Agent",
"value": "ACE-Middleware/1.0"
}
],
"allowedMethods": ["GET", "POST", "PUT", "DELETE"],
"responseFields": ["id", "status", "timestamp", "data"]
}
-- PENTING: Gunakan wildcard '*' untuk flat YAML
DECLARE config REFERENCE TO Environment.Variables;
DECLARE success BOOLEAN;
CALL ACE_LIB.getConfig(
'FLAT_CONFIG',
'*', -- Wildcard key untuk ambil semua
'/path/to/CONFIG2.yaml',
'600',
config
) INTO success;
IF success THEN
-- Akses scalar values
DECLARE apiSecret CHARACTER config.ApiSecret;
DECLARE endpoint CHARACTER config.endpoint;
DECLARE retries CHARACTER config.retryAttempts;
-- Loop simple string arrays
DECLARE methodRef REFERENCE TO config.allowedMethods[1];
WHILE LASTMOVE(methodRef) DO
DECLARE method CHARACTER methodRef;
-- Process method: "GET", "POST", etc.
MOVE methodRef NEXTSIBLING;
END WHILE;
-- Loop array of objects
DECLARE headerRef REFERENCE TO config.headers[1];
WHILE LASTMOVE(headerRef) DO
DECLARE headerName CHARACTER headerRef.name;
DECLARE headerValue CHARACTER COALESCE(headerRef.value, '');
MOVE headerRef NEXTSIBLING;
END WHILE;
END IF;
✅ Flat YAML structure (no root key)
✅ Wildcard '*' key untuk akses full config
✅ Arrays of simple strings (allowedMethods, responseFields)
✅ Mixed content: objects and arrays at root level
✅ Direct key-value pairs di root level
'*' adalah special key untuk flat YAML