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

Allow defining active plugins outside of the database #10766

Closed
oplik0 opened this issue Jul 14, 2022 · 2 comments
Closed

Allow defining active plugins outside of the database #10766

oplik0 opened this issue Jul 14, 2022 · 2 comments

Comments

@oplik0
Copy link
Contributor

oplik0 commented Jul 14, 2022

Description

A generalization of the feature that #10036 was trying to add.

Having to define plugin state in the database causes some issues for example if one wants to create a reproducible configuration. Additionally, it means that instances sharing a database have to share all enabled plugins as well.

As such, I'm proposing (and will try implementing :) to allow plugin state to be defined via nconf as well - which would let them be defined in config.json, environmental variables and command line flags, covering probably all use cases without creating additional files NodeBB might rely on.

My current idea would be that if such configuration is detected it is used instead of the database. This would ensure the configuration always results in the expected behavior (no random plugin enabled because it was in database), and since it's opt-in anyway, it wouldn't break any current workflow.

One thing I'm uncertain of:
Should the implementation write state changes in ACP to config.json, or should one assume the passed configuration is how it should be and basically disable this functionality of ACP?

Community forum reference

No response

@julianlam
Copy link
Member

Keep the behaviours predictable. If defining plugins via configuration, then there is no need to sync plugins.active

@julianlam
Copy link
Member

In fact, I'd disable the ACP outright

oplik0 added a commit to oplik0/NodeBB that referenced this issue Jul 14, 2022
julianlam added a commit that referenced this issue Jul 25, 2022
* Revert "Revert "feat: cross origin opener policy options (#10710)""

This reverts commit 46050ac.

* Revert "Revert "chore(i18n): fallback strings for new resources: nodebb.admin-settings-advanced""

This reverts commit 9f291c0.

* feat: closes #10719, don't trim children if category is marked section

* feat: fire hook to allow plugins to filter the pids returned in a user profile

/cc julianlam/nodebb-plugin-support-forum#14

* fix: use `user.hidePrivateData();` more consistently across user retrieval endpoints

* feat: Allow defining active plugins in config

resolves #10766

* fix: assign the db result to files properly

* test: add tests with plugins in config

* feat: better theme change handling

* feat: add visual indication that plugins can't be activated

* test: correct hooks

* test: fix test definitions

* test: remove instead of resetting nconf to avoid affecting other tests

* test: ... I forgot how nconf worked

* fix: remove negation

* docs: improve wording of error message

* feat: reduce code duplication

* style: remove a redundant space

* fix: remove unused imports

* fix: use nconf instead of requiring config.json

* fix: await...

* fix: second missed await

* fix: move back from getActiveIds to getActive

* fix: use paths again?

* fix: typo

* fix: move require into the function

* fix: forgot to change back to getActive

* test: getActive returns only id

* test: accedently commented out some stuff

* feat: added note to top of plugins page if \!canChangeState

Co-authored-by: Julian Lam <julian@nodebb.org>
Co-authored-by: Barış Soner Uşaklı <barisusakli@gmail.com>
julianlam added a commit that referenced this issue Jul 26, 2022
* Revert "Revert "feat: cross origin opener policy options (#10710)""

This reverts commit 46050ac.

* Revert "Revert "chore(i18n): fallback strings for new resources: nodebb.admin-settings-advanced""

This reverts commit 9f291c0.

* feat: closes #10719, don't trim children if category is marked section

* feat: fire hook to allow plugins to filter the pids returned in a user profile

/cc julianlam/nodebb-plugin-support-forum#14

* fix: use `user.hidePrivateData();` more consistently across user retrieval endpoints

* fix: better looking placeholder text for ACP search

* fix: bug where fallback to forum search was not working due to client-side error

* feat: allow plugins to toggle whether IPs are shown in the users CSV export

* feat: Allow defining active plugins in config (#10767)

* Revert "Revert "feat: cross origin opener policy options (#10710)""

This reverts commit 46050ac.

* Revert "Revert "chore(i18n): fallback strings for new resources: nodebb.admin-settings-advanced""

This reverts commit 9f291c0.

* feat: closes #10719, don't trim children if category is marked section

* feat: fire hook to allow plugins to filter the pids returned in a user profile

/cc julianlam/nodebb-plugin-support-forum#14

* fix: use `user.hidePrivateData();` more consistently across user retrieval endpoints

* feat: Allow defining active plugins in config

resolves #10766

* fix: assign the db result to files properly

* test: add tests with plugins in config

* feat: better theme change handling

* feat: add visual indication that plugins can't be activated

* test: correct hooks

* test: fix test definitions

* test: remove instead of resetting nconf to avoid affecting other tests

* test: ... I forgot how nconf worked

* fix: remove negation

* docs: improve wording of error message

* feat: reduce code duplication

* style: remove a redundant space

* fix: remove unused imports

* fix: use nconf instead of requiring config.json

* fix: await...

* fix: second missed await

* fix: move back from getActiveIds to getActive

* fix: use paths again?

* fix: typo

* fix: move require into the function

* fix: forgot to change back to getActive

* test: getActive returns only id

* test: accedently commented out some stuff

* feat: added note to top of plugins page if \!canChangeState

Co-authored-by: Julian Lam <julian@nodebb.org>
Co-authored-by: Barış Soner Uşaklı <barisusakli@gmail.com>

* feat: show an informative message when no plugins are found after filtering

fixes #10771

* Latest translations and fallbacks

* Latest translations and fallbacks

* chore(deps): bump ace-builds from 1.7.1 to 1.8.1 in /install

Bumps [ace-builds](https://github.com/ajaxorg/ace-builds) from 1.7.1 to 1.8.1.
- [Release notes](https://github.com/ajaxorg/ace-builds/releases)
- [Changelog](https://github.com/ajaxorg/ace-builds/blob/master/CHANGELOG.md)
- [Commits](ajaxorg/ace-builds@v1.7.1...v1.8.1)

---
updated-dependencies:
- dependency-name: ace-builds
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix: swap out icons in ACP > Manage > Categories to more intuitive ones, remove extra placeholder div

* fix: hide expando button if no subcategories; remove attempt at establishing common vars, increased spacing between categories in list

* fix: buggy expando state on category drag/drop

Co-authored-by: Barış Soner Uşaklı <barisusakli@gmail.com>
Co-authored-by: Opliko <opliko.reg@protonmail.com>
Co-authored-by: Misty Release Bot <deploy@nodebb.org>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
julianlam added a commit that referenced this issue Jul 26, 2022
* Revert "Revert "feat: cross origin opener policy options (#10710)""

This reverts commit 46050ac.

* Revert "Revert "chore(i18n): fallback strings for new resources: nodebb.admin-settings-advanced""

This reverts commit 9f291c0.

* feat: closes #10719, don't trim children if category is marked section

* feat: fire hook to allow plugins to filter the pids returned in a user profile

/cc julianlam/nodebb-plugin-support-forum#14

* fix: use `user.hidePrivateData();` more consistently across user retrieval endpoints

* fix: better looking placeholder text for ACP search

* fix: bug where fallback to forum search was not working due to client-side error

* feat: allow plugins to toggle whether IPs are shown in the users CSV export

* feat: Allow defining active plugins in config (#10767)

* Revert "Revert "feat: cross origin opener policy options (#10710)""

This reverts commit 46050ac.

* Revert "Revert "chore(i18n): fallback strings for new resources: nodebb.admin-settings-advanced""

This reverts commit 9f291c0.

* feat: closes #10719, don't trim children if category is marked section

* feat: fire hook to allow plugins to filter the pids returned in a user profile

/cc julianlam/nodebb-plugin-support-forum#14

* fix: use `user.hidePrivateData();` more consistently across user retrieval endpoints

* feat: Allow defining active plugins in config

resolves #10766

* fix: assign the db result to files properly

* test: add tests with plugins in config

* feat: better theme change handling

* feat: add visual indication that plugins can't be activated

* test: correct hooks

* test: fix test definitions

* test: remove instead of resetting nconf to avoid affecting other tests

* test: ... I forgot how nconf worked

* fix: remove negation

* docs: improve wording of error message

* feat: reduce code duplication

* style: remove a redundant space

* fix: remove unused imports

* fix: use nconf instead of requiring config.json

* fix: await...

* fix: second missed await

* fix: move back from getActiveIds to getActive

* fix: use paths again?

* fix: typo

* fix: move require into the function

* fix: forgot to change back to getActive

* test: getActive returns only id

* test: accedently commented out some stuff

* feat: added note to top of plugins page if \!canChangeState

Co-authored-by: Julian Lam <julian@nodebb.org>
Co-authored-by: Barış Soner Uşaklı <barisusakli@gmail.com>

* feat: show an informative message when no plugins are found after filtering

fixes #10771

* Latest translations and fallbacks

* Latest translations and fallbacks

* chore(deps): bump ace-builds from 1.7.1 to 1.8.1 in /install

Bumps [ace-builds](https://github.com/ajaxorg/ace-builds) from 1.7.1 to 1.8.1.
- [Release notes](https://github.com/ajaxorg/ace-builds/releases)
- [Changelog](https://github.com/ajaxorg/ace-builds/blob/master/CHANGELOG.md)
- [Commits](ajaxorg/ace-builds@v1.7.1...v1.8.1)

---
updated-dependencies:
- dependency-name: ace-builds
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix: swap out icons in ACP > Manage > Categories to more intuitive ones, remove extra placeholder div

* fix: hide expando button if no subcategories; remove attempt at establishing common vars, increased spacing between categories in list

* fix: buggy expando state on category drag/drop

Co-authored-by: Barış Soner Uşaklı <barisusakli@gmail.com>
Co-authored-by: Opliko <opliko.reg@protonmail.com>
Co-authored-by: Misty Release Bot <deploy@nodebb.org>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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