Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration #331

Open
thekid opened this issue Sep 29, 2018 · 1 comment
Open

Configuration #331

thekid opened this issue Sep 29, 2018 · 1 comment

Comments

@thekid
Copy link
Member

thekid commented Sep 29, 2018

Scope of Change

A new Configuration API will replace util.Properties

Rationale

Functionality

File format

Basically an INI file, but typed.

[section]
key="value"    ; A string. Quotes are necessary for strings!
key='value'    ; Another string
power=6100     ; An integer number
factor=1.5     ; A decimal number
switch=off     ; A boolean (on/off/true/false/yes/no)
list=[1, 2, 3] ; A list

API

$c= new Configuration();
$c->load('file.ini');

$c->value('section', 'key');   // string(5) "value"
$c->value('section', 'power'); // int(6100)

$section= $c->section('section');
$section->value('switch');     // false

Security considerations

Speed impact

Dependencies

Related documents

https://madmurphy.github.io/libconfini/html/libconfini.html
https://github.com/graniticio/inifile

@thekid
Copy link
Member Author

thekid commented Sep 29, 2018

Differences to INI

See https://en.wikipedia.org/wiki/INI_file

  • Quotes are necessary for strings!
  • Case sensitivity

Differences to TOML

See https://github.com/toml-lang/toml

  • No first-class dates
  • No multiline arrays
  • No inline tables
  • Use of ; for comments, like in INI files
  • No support for underscores in numbers
  • No octal numbers
  • No hexadecimals numbers
  • No scientific notation for decimals

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant