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

Move configuration to key-value #8

Open
ricardoekm opened this issue Dec 4, 2019 · 1 comment
Open

Move configuration to key-value #8

ricardoekm opened this issue Dec 4, 2019 · 1 comment
Labels

Comments

@ricardoekm
Copy link
Owner

ricardoekm commented Dec 4, 2019

Related to #3 .

Rely on line position for configuration makes it hard to read and write the file and is fragile. This also makes impossible to add comments to the config.

The recommended approach usually is to use a key-value implementation (.json for Javascript or .properties for Java). Javascript has native support for .json, which makes it the natural choice.

var lines = fs
.readFileSync(configFile)
.toString()
.split("\n");
this.config = {};
this.config.serverPortNumber = lines[1].replace("\r", "");
this.config.database = lines[2].replace("\r", "").toLowerCase();
this.config.serverName = lines[3].replace("\r", "");

Splitting the configuration of the compiler and the back-end and using .json + Config Module seems a good option.

@tracyhenry
Copy link

Yes, also tracked here: tracyhenry#64

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

No branches or pull requests

2 participants