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

Generate salts every time the container starts, unless they're set via environment variables #49

Closed
wants to merge 2 commits into from

Conversation

Morpheus636
Copy link
Contributor

New behavior

This pull request makes the container generate wp-secrets.php every time the container is recreated.

The secrets are still not persisted, so users will need to log in again each time the container is recreated. The secrets can instead be persisted by setting them in environment variables. If all the appropriate environment variables are set, the secrets will not be re-generated. This behavior is not documented in the README, though it is documented in a comment within the placeholder wp-secrets.php file.

Previous behavior

Previously, when updating or recreating the container, the wp-secrets.php reverts to the original state without secrets defined. This is because the persistent volume is mounted to /var/www/wp-content, but the secrets are in /usr/src/wordpress/wp-secrets.php which is NOT part of the volume.

I believe this closes #42, though feedback from @bb on that matter would be appreciated.

@TrafeX
Copy link
Owner

TrafeX commented Dec 31, 2023

Hi @Morpheus636,

Thank you for your suggestions! It made me dive into this issue and I was able to reproduce it.
Your solution is nice, but as you mentioned, it has a downside of recreating the secrets when the container is recreated. That's why I choose for a different way to solve this: #50
Could you take a look and see if there are any downsides to that solution? Locally it works and I see that my session is persisted when I recreate the container.

@Morpheus636
Copy link
Contributor Author

Superseded by #50

@Morpheus636 Morpheus636 closed this Jan 1, 2024
@Morpheus636 Morpheus636 deleted the salt-generation branch January 3, 2024 20:25
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.

wp-secrets.php is not persisted and only generated when the volume is empty
2 participants