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

Simplify management of documentation of default configuration #307

Open
pmeijer opened this issue Mar 6, 2023 · 2 comments
Open

Simplify management of documentation of default configuration #307

pmeijer opened this issue Mar 6, 2023 · 2 comments

Comments

@pmeijer
Copy link
Contributor

pmeijer commented Mar 6, 2023

The ./config/config.default.js should contain the documentation as well as the default values.

Suggestion is to augment the json structure with metadata such as doc, type, category, value etc. When requiring the file as a config - the structure should be transformed back into the regular config format.

Depending on the category the config variables would be listed from "default", "advanced", "cli".

Example of how the format could look like:

    config = {
        addOn: {
            doc: "AddOn are stateful server workers listening in on changes made to a branch",
            type: "container",
            category: "default",
            enable: {
                doc: "If true enables add-ons",
                value: false
            },
            monitorTimeout: {
                category: "advanced",
                doc: "In milliseconds, the waiting time before add-ons are stopped after no activity (new clients joined or hash updates) in the branch.",
                displayValue: '2 * 60 * 1000',
                value: 2 * 60 * 1000,
            },
            workerUrl: {
                category: "advanced",
                doc: "If given the webgme server will not spawn a child process for running add-ons and instead post the related events to the url. Use addon_handler.js for a machine handling such requests.",
                value: null
            },
            basePaths: {
                category: "cli",
                doc: "Array of paths to custom add-ons. If you have an add-on at `C:/SomeAddOns/MyAddOn/MyAddOn.js` the path to append would be `C:/SomeAddOns` or a relative path (from the current working directory). N.B. this will also expose any other add-on in that directory, e.g. `C:/SomeAddOns/MyOtherAddOn/MyOtherAddOn.js`.",
                type: "array",
                displayValue: "[path.join(__dirname, '../src/addon/core')]",
                value: [path.join(__dirname, '../src/addon/core')]
            }
        },
...
@brollb
Copy link
Collaborator

brollb commented Mar 6, 2023

Have we looked at other libraries that could help us here? I just want to make sure we aren't re-inventing the wheel :)

Also, are we planning on updating the generated documentation to include this?

@pmeijer
Copy link
Contributor Author

pmeijer commented Mar 6, 2023

No but that’s a good point. I’m just adding the requirements I had in mind here to open up a discussion about it.
Yes it should generate the docs. Probably also add a test that checks that the docs are in sync with the latest config file.
Any suggestions are welcomed.

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

No branches or pull requests

2 participants