Advanced YINI Code Examples

Level: Advanced / Optional features

These examples show how YINI supports more advanced configuration scenarios beyond everyday usage, including optional syntax features, extended value formats, and production-level setups.

⚠️ Note: These examples demonstrate optional syntax, edge cases, and advanced capabilities. You do not need these features to use YINI effectively. If you're new to YINI, start with the Get Started guide or the Basic examples.

See everyday YINI configuration examples on the main Examples page.

Example: CLI application options

@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!

Example: Database connection configuration

@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

Example: Feature flags configuration

/*

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

Example: 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
	"""

Looking for everyday examples?
β€’ Common real-world examples.
β€’ Core and practical YINI config examples.


Next steps

  • ➑️ Get Started
    Learn how to install and use YINI.
  • ➑️ Basic Examples
    See minimal, everyday YINI configuration examples.