[5.x]: Cannot use env vars for plugin licenses
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 3.6k
- Forks
- 705
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 134
Description
What happened?
Description
When trying to store env variables in the plugin licenses, craft seems to just revert them back to the plain text value whenever we run project config apply.
Happy to send a video over to an email for evidence, though this has been reported internally as being really sporadic.
Update:
I have actually just noticed, it looks like something is writing to my .env file? If I use $license as the env var in the CMS, it then adds that env var to the file. Though I would've thought if the env var already exists and the license key is set to use it in the project config, it wouldn't matter.
Steps to reproduce
- Save an env variable in a plugin license
- Craft shows that there are pending project config changes
- Run pc/apply
- Plugin license now shows plain text key instead of env var
Expected behavior
Actual behavior
Craft CMS version
5.7.0
PHP version
8.2
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the behavior with a plugin license, an existing environment variable in .env, and pc/apply. Trace how project config apply reads and writes the license value and .env; done means the configured environment-variable reference remains intact after applying project config instead of becoming plaintext.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 38/100