Skip to content

feat: add config file #740

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

Merged
merged 27 commits into from
Feb 28, 2025
Merged

Conversation

m-mattia-m
Copy link
Contributor

This PR gives the users the possibility to set up their pingvin-share instance with a single config file (config.yaml). You can mount this file into the container, and then it is going to set the value into the config table. However, this option is disabled per default.

Co-authored-by: Elias Schneider <[email protected]>
@m-mattia-m
Copy link
Contributor Author

I will implement those changes in a few days. :)

@stonith404
Copy link
Owner

Sure, take your time :)

@m-mattia-m
Copy link
Contributor Author

m-mattia-m commented Feb 5, 2025

I've been busy the last few weeks and, unfortunately, will be in the next few weeks too. I will implement this feature right after that. :)

@stonith404
Copy link
Owner

Sure take your time :)

@brunnels
Copy link

@m-mattia-m Do you need any help with this? I could help get it over the line if you're out of time or lost interest.

@m-mattia-m
Copy link
Contributor Author

m-mattia-m commented Feb 21, 2025

Hi @brunnels, unfortunately I have a lot going on at the moment, so I plan to implement it at the end of March or the beginning of April. However, if you need it sooner or prefer to do it earlier, feel free to implement it yourself. :)

@m-mattia-m
Copy link
Contributor Author

@brunnels, I hope you haven't already started implementing this feature. I was overthinking it so much that I ended up starting to implement it myself. 😆

@stonith404, what does the "order" do in the config table? I couldn’t figure it out, and there’s an open TODO in my MR. :)

@stonith404
Copy link
Owner

Thanks, I'll look into it ASAP. The "order" property just defines in which order the input gets displayed on the admin page.

@stonith404
Copy link
Owner

I made some additional changes. The yaml config won't be saved to the database now, it will be read from the memory.

I've tested it but could you also test it again to make sure that everything works as expected?

@m-mattia-m
Copy link
Contributor Author

m-mattia-m commented Feb 26, 2025

I think there was an issue in the isEditAllowed function because if I had the config enabled, some fields like the appUrl would have been enabled even though it shouldn't be. Another issue was that this function checked for the value, which doesn't matter in this situation. Or do I miss something? 😅) Further, I added a check in the updateMany function to enhance the usability because it returned a success even though it should be an error.

I tested it with these changes, and I think it should be fine. However, I would appreciate it if you could test it again on account of changing the isEditAllowed function.

@stonith404
Copy link
Owner

Sorry, I should have explained this better. I wanted to make it possible to set only a few config variables from the YAML file. With my changes, the admin can set certain values like the App URL and LDAP configuration in the config.yml, while the rest can be adjusted in the UI. That’s probably why you were able to change the App URL config.

Or do you think this approach is too confusing?

By the way, I also added a script that automatically generates the config.example.yml. This makes things easier when config variables are added or their descriptions change.

@m-mattia-m
Copy link
Contributor Author

I think it would be more straightforward to have either a dynamic config or a static config via a configuration file. Most configurations are set once at the beginning and are rarely changed afterward. If you need to make updates, you can simply modify the config.yaml file and run docker compose down && docker compose up -d (or just delete the K8s pod).

Another question: Did you intentionally remove the initUser config? I believe it would be very useful to create an admin user via the configuration file (though you should change the password once it's up and running).

That said, generating the config.yaml file via a script makes sense and is a good idea.

@stonith404
Copy link
Owner

Thanks for the feedback. Yeah you're right this makes it unnecessarily complicated for a minimal value. I reverted the change and updated the text in the info box accordingly.

I missed initUser in my script but I've added it now.

Does everything look good to you know?

@m-mattia-m
Copy link
Contributor Author

m-mattia-m commented Feb 28, 2025

I tested it again and it worked for me. I think it looks good, so we could merge it. :)

@stonith404
Copy link
Owner

Great, thanks again :)

@stonith404 stonith404 merged commit 9dfb52a into stonith404:main Feb 28, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants