Skip to content

vphammer/adocconf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

adocconf

Gem Version

Inspired by mdconf, adocconf allows you to write configuration in the AsciiDoc format.

Usage:

adocconf parse path/to/file.adoc

An example of valid adocconf is below:

:default-host: default
:default-port: 8080
:env: prod

== Servers

=== server1

Strings like these are ignored by the parser, so you can add comments to your config for clarity.

host:: localhost
port:: 80

=== server2

host:: {default-host}
port:: {default-port}

=== server3

ifeval::["{env}" == "prod"]
host:: prod.example.com
port:: 443
endif::[]

ifeval::["{env}" == "dev"]
host:: dev.example.com
port:: 4343
endif::[]

== Features

* login
* signup
* analytics

== Other Servers

[options="header"]
|===
| Name | Host | Port
| server1 | {default-host} | {default-port}
| server2 | remote | 9090
|===

This will parse as the below JSON object:

{
  "servers": {
    "server1": {
      "host": "localhost",
      "port": "80"
    },
    "server2": {
      "host": "default",
      "port": "8080"
    },
    "server3": {
      "host": "prod.example.com",
      "port": "443"
    }
  },
  "features": [
    "login",
    "signup",
    "analytics"
  ],
  "other_servers": [
    {
      "Name": "server1",
      "Host": "default",
      "Port": "8080"
    },
    {
      "Name": "server2",
      "Host": "remote",
      "Port": "9090"
    }
  ]
}

Releases

Packages

Contributors

Languages