-
Notifications
You must be signed in to change notification settings - Fork 211
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
Extension configuration is broken #847
Comments
I had a look. Unfortunately it not simple to fix so it will take a while. I had to restructure the config lib to have UI generation support for extensions too, but that apparently broke some config loading. |
I think I found the problem in this change. Previously, I think the fix is to I'll put together a pull request with my fix shortly. |
Hmm, my simple change only fixes the case where some extension config already exists in the |
I might know what's going on now with regards to the empty/new extension config. I think it will need to be fixed in typeconfig. This is where the extension configurations are added - an array of This is the code responsible for filling arrays from JSON. It has a special case to try JSON-decoding a string within an array, but aside from that, it will end up calling We're basically guaranteed that the |
It looks like typeconfig doesn't have this problem when a key is a nested Along that line, is there a way to dynamically add a If that's not possible, then (and I'll be the first to admit this is an ugly hack), then maybe we could add a bunch of these to the @ConfigProperty({
tags: {
name: $localize`Installed extension 1`,
priority: ConfigPriority.advanced
}
})
extension1?: ServerExtensionsEntryConfig;
@ConfigProperty({
tags: {
name: $localize`Installed extension 2`,
priority: ConfigPriority.advanced
}
})
extension2?: ServerExtensionsEntryConfig;
...and so on... |
added d4d8dcf that hopefully fixes the issue. Long story short, with the nice UI support I had to make fundametnal changes to the config library that created a circular depdenency between the config and extensions. I need to major code rafactor around the extensions handling to undo the circular dependency. I found it hard to test so far, so its just "best effort now". Also note the extension interface changed. There is now a separate function to set the config template. See example. |
I tried d4d8dcf, and got an error. The next commit without the error is 7f65dfd, and extension configuration is still broken. When starting from an empty config, the admin page doesn't populate anything. When starting with a known-good config, the admin page shows the extension location, and that's it:
Can you re-open this? Or should I open a new issue? |
Ahh annoying. I got quiet busy with life until like July, but I'll try to fix it. Let's reopen this. |
@mblythe86 |
Yes, I updated my I realized today that my issue might have been that I didn't run Just to check that my I also tried the sample extension. The first issue I hit with that was this:
After fixing that locally, it still wouldn't load the extension. In fact, it didn't even recognize that a new extension had been added at all! |
It looks like
I haven't examined the most recent refactor of the extension loading code, so maybe the process to discover new extensions happens somewhere else now? |
I have done some debug, and I've made some local changes that fix most of the problems. I'll file another pull request soon. The one thing I haven't been able to fix is the case of adding an extension to an existing install (i.e. when config.json already exists). This seems to be a limitation of typeconfig. I'll raise an issue there describing the problem, and you can evaluate whether it's something that should be fixed or not. |
* Actually add/remove extensions from `Config.Extensions.extensions` * Fix the file path where `ExtensionConfigTemplateLoader` looks for extensions * Prevent the first `loadSync()` call from creating a `config.json` file Works around bpatrik/typeconfig#27
I made #885 (also some commits to typeconfig) that brings us one step closer to the solution |
The last commit should (mostly) fix this issue. There are still 2 outstanding TODOs to fully fix it:
+1 there is some issue with the default values if the config is not loaded form JSON. And default values can mess up for extension. Default values are only used for making the UI bold blue, so not a big issue. Solving 1. by using an Map instead of an array, should also solve 2. |
I had to change the extension interface again: config has now a separate config.js file to set it up. (I had to separate it, so just setting up the config does not need running npm install an all extensions. This would have delayed the app startup). See sample extension. |
@mblythe86 Made some comments here and also at one of your PR and your comment in the other repo. The not-so-technical root cause of the whole issue is that:
|
No worries! It sounded from a previous comment like you were pretty busy in your private life, so I was just trying to do what I could. If you have an idea about what still needs to change in typeconfig and/or pigallery2 to get this fully working, please share. I'm happy to learn more about the codebase and give it a try. It sounds like the |
I think now extension config is more or less working for majority of the cases. To fix the outstanding issues, I think the best approach would be to actually use a Map like object then a array. But as I mentioned in typeconfig that is not really supported, so just changing to it might not work out of the box. If that is the case, I plan to add a "addNewProperty" to the generic configtype that does all the magic. |
The latest commit should fix this issue. Please confirm. |
I still need this tweak in order for pigallery2 to find my extensions at all:
I'm not sure if this is due to some oddity in how I'm building my Docker image for testing (I'm using a slightly modified version of Aside from that, it's working well! Naturally, my settings didn't transfer from a previous I also tested with a non-existent Also, I tested adding & removing extensions, and it works as expected - showing the default values for any newly-added extensions, not showing settings for deleted extensions, and preserving values for unchanged extensions. |
I think it's a real bug. I just pulled the
I'll submit a pull request with the fix from my previous comment. |
That seems to fix it, thanks! |
Describe the bug
The values from
extension.config.getConfig()
no longer reflect what is present inconfig.json
, nor what is shown on the admin page.Screenshots (optional)
This is present in my config.json:
This is what the admin page shows:
Server logs (optional)
When I have the extension dump the
extension.config.getConfig()
object, the state has the default values, not my real values:Environment (please complete the following information):
Used app version:
Compiled from source: github commit 3811fc3
The text was updated successfully, but these errors were encountered: