A small library for reading .ini files into Clojure maps.
Add
<dependency>
<groupId>clojure-ini</groupId>
<artifactId>clojure-ini</artifactId>
<version>0.0.2</version>
</dependency>
to your pom.xml file.
Add [clojure-ini "0.0.2"] as a dependency to your project.clj.
(read-ini source & opts) where source can be anything accepted by
io/reader. Valid options are
:keywordize?(defaultfalse): Turn segments and property-keys into keywords:trim?(defaulttrue): trim segments, keys and values:allow-comments-anywhere?(defaulttrue): Comments can appear anywhere, and not only at the beginning of a line:comment-char(default\;)
conf.ini:
; last modified 1 April 2001 by John Doe
name=John Doe
organization=Acme Widgets Inc.
[database]
; use IP address in case network name resolution is not working
server=192.0.2.62
port=143
file = payroll.dat
REPL session:
> (use 'clojure-ini.core)
> (read-ini "conf.ini" :keywordize? true)
{:database {:file "payroll.dat"
:port "143"
:server "192.0.2.62"}
:organization "Acme Widgets Inc."
:name "John Doe"}
Copyright (C) 2011-2014 Jonas Enlund
Distributed under the Eclipse Public License, the same as Clojure.