# ACE_LIB.getConfig - More Examples Repository ini berisi contoh-contoh penggunaan fungsi `ACE_LIB.getConfig()` untuk parsing YAML nested dengan berbagai skenario. ## Overview Fungsi `getConfig()` adalah YAML parser yang dapat membaca file konfigurasi dengan struktur nested (object dan array) dan mengembalikan JSON yang dapat langsung diakses di ESQL. ## Test Scenarios Repository ini menyediakan **5 skenario testing** yang mencakup berbagai use case: | Config | Scenario | Description | |--------|----------|-------------| | [CONFIG1.yaml](configs/CONFIG1.yaml) | **Standard Nested YAML** | Multiple root keys dengan nested objects dan arrays | | [CONFIG2.yaml](configs/CONFIG2.yaml) | **Flat YAML** | Structure flat tanpa root key, diakses dengan wildcard `'*'` | | [CONFIG3.yaml](configs/CONFIG3.yaml) | **Corner Case: Empty Values** | Testing empty values, mixed arrays, dan special characters | | [CONFIG4.yaml](configs/CONFIG4.yaml) | **Corner Case: Deep Nesting** | Deep nesting (5+ levels) dan complex nested structures | | [CONFIG5.yaml](configs/CONFIG5.yaml) | **Simple Key-Value** | Practical real-world config dengan arrays dan nested objects | ## Repository Structure ``` ACE_LIB.getConfig-moreExample/ ├── README.md # File ini ├── configs/ # 5 File YAML untuk testing │ ├── CONFIG1.yaml │ ├── CONFIG2.yaml │ ├── CONFIG3.yaml │ ├── CONFIG4.yaml │ └── CONFIG5.yaml ├── parseResults/ # Hasil JSON dari parsing │ ├── hasilParseConfig1.json │ ├── hasilParseConfig2.json │ ├── hasilParseConfig3.json │ ├── hasilParseConfig4.json │ └── hasilParseConfig5.json └── docs/ # Detailed documentation ├── config1-scenario.md ├── config2-scenario.md ├── config3-scenario.md ├── config4-scenario.md └── config5-scenario.md ``` ## Detailed Documentation Untuk penjelasan lengkap setiap skenario, lihat dokumentasi berikut: - [Config 1: Standard Nested YAML](docs/config1-scenario.md) - [Config 2: Flat YAML with Wildcard](docs/config2-scenario.md) - [Config 3: Empty Values & Mixed Content](docs/config3-scenario.md) - [Config 4: Deep Nesting & Complex Structures](docs/config4-scenario.md) - [Config 5: Simple & Practical Config](docs/config5-scenario.md) ## Quick Start ### Cara Menggunakan Test Files ```esql -- Example: Load CONFIG1 dengan key 'fundtastic' DECLARE config REFERENCE TO Environment.Variables; DECLARE success BOOLEAN; CALL ACE_LIB.getConfig( 'TEST_CONFIG1', -- Cache ID 'fundtastic', -- Key yang akan diambil '/path/to/CONFIG1.yaml', -- Path ke file '600', -- Cache expiry (seconds) config -- OUT: Reference hasil parse ) INTO success; IF success THEN -- Akses data DECLARE apiSecret CHARACTER config.ApiSecret; DECLARE endpoint CHARACTER config.endpoint; END IF; ``` ## Test Coverage | Feature | Config 1 | Config 2 | Config 3 | Config 4 | Config 5 | |---------|----------|----------|----------|----------|----------| | Nested Objects | ✅ | ✅ | ✅ | ✅ | ✅ | | Arrays of Strings | ✅ | ✅ | - | ✅ | ✅ | | Arrays of Objects | ✅ | ✅ | ✅ | ✅ | ✅ | | Multiple Root Keys | ✅ | - | - | - | ✅ | | Flat YAML (wildcard) | - | ✅ | - | - | - | | Empty Values | - | - | ✅ | - | - | | Mixed Arrays | - | - | ✅ | - | - | | Deep Nesting (5+ levels) | - | - | - | ✅ | - | | Special Characters | - | - | ✅ | - | - | ## Notes - Semua config menggunakan **indentasi 2 spasi** per level - Parser support struktur nested unlimited depth (limited by memory) - Semua values di-parse sebagai **string** (tidak ada type conversion) - Empty values (`key:`) di-parse menjadi empty string `""`