Skip to content
flyingwalrusllcPublic

About

OCaml port of lightbend's config library.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

19 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OHocon

OHocon is a port of lightbend's config library.

Tutorial

create a config object

First, you must create a TypeSafeConfig object by parsing an external resource(e.g. a file).

open OHocon

(* load from a string *)
let config = TypeSafeConfigFactory.parse_string "{name:\"john\"}"

(* load from a file *)
let config = TypeSafeConfigFactory.parse_file "/tmp/application.conf"

string

open OHocon

let config = TypeSafeConfigFactory.parse_string "{name:\"john\",countries:[\"jp\", \"us\"]}"

(* get string. Throw an exception if none. *)
let _ = TypeSafeConfig.get_string "name"

(* get string as string option. *)
let _ = TypeSafeConfig.get_string_opt "name"

(* get a list of string. *)
let _ = TypeSafeConfig.get_string_list "countries"

int

open OHocon

let config = TypeSafeConfigFactory.parse_string "{ id: 1, follower_ids: [2,3,4] }"

(* get int. Throw an exception if none. *)
let _ = TypeSafeConfig.get_int "id"

(* get int as int option. *)
let _ = TypeSafeConfig.get_int_opt "id"

(* get a list of int. *)
let _ = TypeSafeConfig.get_int_list "follower_ids"

TODO

Items Status
Comments ❌
Omit root braces ❌
Key-value separator ❌
Commas ❌
Whitespace ❌
Duplicate keys and object merging ❌
Unquoted strings ❌
Multi-line strings ❌
String value concatenation ❌
Array concatenation ❌
Object concatenation ❌
Arrays without commas ❌
Path expressions ❌
Paths as keys ❌
Substitutions ❌
Self-referential substitutions ❌
The += separator ❌
Includes ❌
Include semantics: merging ❌
Include semantics: substitution ❌
Include semantics: missing files ❌
Include semantics: file formats and extensions ❌
Include semantics: locating resources ❌
Include semantics: preventing cycles ❌
Conversion of numerically-index objects to arrays ❌

About

OCaml port of lightbend's config library.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages