Generate JWT Secret if not provided#70
Conversation
|
This is a solid fix. Generating a JWT secret when one isn’t provided makes sense and updating the tests to use One small thing to consider before merge: if the JWT secret is generated at runtime, it would be good to ensure it’s also persisted (e.g., via Happy to approve once we decide whether persistence should be part of this PR or handled separately. |
|
Thanks for the feedback. I can add that to this PR if you like? |
|
Yes, please that would be great. |
|
@Cod-e-Codes Let me know if this is not the desired approach to solve the config_ui.go issue. With this change we are in practice generating the JWT Secret twice. |
|
This approach is fine. The double generation is trivially cheap and the right secret (the one saved to .env) is the one that gets used. Looks good, thanks! |
Pull Request
Description
When I was trying to run marchat server locally to test it out, I used the interactive setup guide. It did not ask me for the JWT Secret, so it was set to a hardcoded string. Perhaps this could be a problem for other people setting up marchat servers using the interactive flag. So I could either add the JWT Secret to the interactive setup, or make the default be a generated hex value.
Also, some of the tests failed on my computer, since I already had a working setup in ~/.config/marchat. I inserted t.TempDir() in the tests that used the default location.
Fixes # (issue)
Type of change
Checklist