Yonle/bostr

Feature Request: Config file instead of config JS

Closed this issue · 2 comments

I just got Bostr running in my cluster, and an idea I had would be to move the configuration out of JS to a more standard config file type.
Something like toml or yaml, or worst case, json.
Then it would be a little easier to programmatically create the config file and restart the service.

What do you think?

The reason why i go with the javascript module approach is mostly to reduce the dependencies that bostr use. At the same time making the config became extensive.

If you have small knowledge to JavaScript or NodeJS's fs module, You could go modify the config to load fs then begin readFileSync so then you could put it into certain field of the config. Eg, authorized_keys.

Here's a short example:

const fs = require("fs");
const peoples = fs.readFileSync("allowedpeoples.txt", "utf8").split("\n");

module.exports = {
  // ....
  authorized_keys: peoples,
  // ....
}

The code above will make bostr to read allowedpeoples.txt, which then will be used to supply authorized_keys.

Ill will give this a try soon and let you know how it goes