Skip to content

Instantly share code, notes, and snippets.

@raphink
Last active August 29, 2015 14:17
Show Gist options
  • Save raphink/56874c75d6e964a2c2c3 to your computer and use it in GitHub Desktop.
Save raphink/56874c75d6e964a2c2c3 to your computer and use it in GitHub Desktop.
module Agocontrol = autoload xfm
let comment = IniFile.comment "#" "#"
let sep = IniFile.sep "=" "="
let entry = IniFile.indented_entry IniFile.entry_re sep comment
let title = IniFile.indented_title IniFile.record_re
let record = IniFile.record title entry
let lns = IniFile.lns record comment
let filter = (incl "/etc/opt/agocontrol/conf.d/*.conf") . (incl "/usr/local/etc/agocontrol/conf.d/*.conf")
let xfm = transform lns filter
module Test_Agocontrol =
let alert_conf = "[mail]
smtp=smtp.free.de
[email protected]
login=
password=
tls=0
[twitter]
key=625343032-XXXXXXXXXXXXXXXXXXXXXXXXXXX
secret=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[push]
provider=pushbullet
[pushbullet]
apikey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
devices=[\"Mozilla Firefox (ujyPVc3SoKadjz99WkCibI)\"]
[sms]
provider=freemobile
[freemobile]
user=XXXXXXXX
apikey=XXXXXXXXXXXXXX\n"
test Agocontrol.lns get alert_conf =
{ "mail"
{ "smtp" = "smtp.free.de" }
{ "sender" = "[email protected]" }
{ "login" }
{ "password" }
{ "tls" = "0" }
}
{ "twitter"
{ "key" = "625343032-XXXXXXXXXXXXXXXXXXXXXXXXXXX" }
{ "secret" = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" }
}
{ "push"
{ "provider" = "pushbullet" }
}
{ "pushbullet"
{ "apikey" = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" }
{ "devices" = "[\"Mozilla Firefox (ujyPVc3SoKadjz99WkCibI)\"]" }
}
{ "sms"
{ "provider" = "freemobile" }
}
{ "freemobile"
{ "user" = "XXXXXXXX" }
{ "apikey" = "XXXXXXXXXXXXXX" }
}
let quotes = "[mqtt]
topic = 'sensors/#'
topic2 = \"sensors2/#\"\n"
test Agocontrol.lns get quotes =
{ "mqtt"
{ "topic" = "sensors/#" }
{ "topic2" = "sensors2/#" } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment