Advanced YINI Code Examples
⚠️ Note: These examples demonstrate optional syntax, edge cases, and advanced features. You do not need any of these features to use YINI effectively. If you're new to YINI, start with the basic examples or the Get Started guide.See everyday YINI configuration examples on the main Examples page.
File example 3: cli-application-options.yini
@yini
/*
Features:
- No newline at end of file
- Sections
- Strings (double quotes), numbers, booleans
- Lists (bracket and colon syntax)
- Line comment with ;
*/
^ CLI
command = "deploy"
dry_run = false
verbosity = 2
include_paths = ["src/", "lib/", "config/"]
--exclude_patterns: "*.test.ts", "*.spec.js"
timeout = 60
; Output settings.
^^ Output
format = "json"
color = yes
log_level = "debug"
# NOTE: No newline at end of file! File example 5: database-connection
@YINI
/*
Features:
- Alternative section marker
- Nested sections
- Objects
- Strings (double quotes)
- Numbers, booleans, nulls
*/
< Database
type = "postgres"
host = "localhost"
port = 5432
username = "admin"
password = "s3cr3t"
db_name = "myapp"
pool = { max: 10, min: 2, idle: 10000 }
<< Options
ssl = off
connection_timeout = 30
retry_attempts = 3
File example 6: feature-flags-example.yini
/*
Features:
- Backticked section headers
- Section nesting
- Booleans (YES/NO/ON/OFF/TRUE/FALSE/NULL)
- Lists
- Nulls
*/
^ `Features`
beta = TRUE
dark_mode = ON
experimental_ui = NO
welcome_tour = YES
^^ `User Groups`
admin = ["alice", "bob"]
beta_testers = ["charlie", "dana"]
regular_users = []
^^ `Feature Toggles`
feature_x = TRUE
feature_y = FALSE
feature_z = NULL
File example 7: email-smtp-configuration
/*
Features:
- Shorthand section markers
- Numbers, booleans
- Multi-line triple-quoted strings
- Null (upper case)
*/
^1 SMTP
server = 'smtp.mailserver.com'
port = 587
use_tls = true
username = 'mailer'
password = 'change_me'
^2 Defaults
from_address = 'noreply@example.com'
reply_to = NULL
signature = """Kind regards,
The Example Team
"""
Next steps
-
➡️ Get Started
Learn how to install and use YINI. -
➡️ Basic Examples
See minimal, everyday YINI configuration examples.
