benoitc / benoitc/econfig

Key written to incorrect section in ini file

Open
#11 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Erlang
Stars
79
Forks
11
PR merge metrics
No merged PRs in 30d

Description

Trying out the example and watching the actual INI file get written to file, doesn't result in the expected output. The new key value written below ends up in the subsequent section rather than section1.

```
Eshell V8.0 (abort with ^G)
1> application:ensure_all_started(econfig).
{ok,[econfig]}
2> econfig:register_config(test, ["test.ini"], [autoreload]).
ok
3> econfig:subscribe(test).
ok
4> econfig:get_value(test, "section1").
[{"key 3","value 3"},
{"key1","value1"},
{"key2","value 2"},
{"key4","value 4"},
{"key5","value5"}]
5> econfig:get_value(test, "section 2").
[{"key10","value10"},
{"key7","value7"},
{"key8","value8"},
{"key9","value 9"}]
6> econfig:set_value(test, "section1","key6", "value6").
ok
7> econfig:get_value(test, "section1").
[{"key 3","value 3"},
{"key1","value1"},
{"key2","value 2"},
{"key4","value 4"},
{"key5","value5"},
{"key6","value6"}]
8> econfig:get_value(test, "section 2").
[{"key10","value10"},
{"key7","value7"},
{"key8","value8"},
{"key9","value 9"}]
9>
```

resulted in the following:

```
[section1]
key1 = value1
key2 = value 2
key 3 = value 3
key4 = value 4; this is a comment
key5 = value5 ; this is a comment

[section 2]
key7 = value7
key8 = value8
key9 = value 9 ; another comment here
key10 = value10 ; yet another comment
key6 = value6
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.