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

FR: Ability to store plugin license keys in .env file #4393

Closed
monachilada opened this issue Jun 11, 2019 · 9 comments
Closed

FR: Ability to store plugin license keys in .env file #4393

monachilada opened this issue Jun 11, 2019 · 9 comments

Comments

@monachilada
Copy link
Contributor

Description

For security reasons, it would be nice to be able to keep my plugin licenses stored in my .env files and out of the project.yaml file in my repo. Currently it's only possible to have the license defined explicitly in the project config file.

@brandonkelly
Copy link
Member

This is possible with the CRAFT_LICENSE_KEY PHP constant.

.env:

LICENSE_KEY="#########..."

web/index.php (after loading .env):

define('CRAFT_LICENSE_KEY', getenv('LICENSE_KEY'));

@monachilada
Copy link
Contributor Author

This is possible with the CRAFT_LICENSE_KEY PHP constant.

For the Craft license sure, but I was talking about specific 3rd party plugin licenses.

@brandonkelly
Copy link
Member

Sorry, somehow I missed that!

@brandonkelly
Copy link
Member

Just added the ability to set plugin license keys to environment variables using the $VARIABLE_NAME syntax, for the next release. If you do, they will be saved to your project.yaml file the same way, so the license key won’t make it into your repo.

@monachilada
Copy link
Contributor Author

Fantastic, thank you!

@jurriaanr
Copy link

Small problem with this is that the name of the variable has a max length because the field is cut to the length of a license key

@brandonkelly
Copy link
Member

@jurriaanr Thanks for pointing that out. Just removed the maxlength input attribute for today’s 3.2.6 release.

@janklan
Copy link

janklan commented Sep 6, 2020

For those interested in storing the license key in an environment variable: don't forget to add define('CRAFT_LICENSE_KEY', getenv('LICENSE_KEY')); also to the /craft executable.

@khalwat
Copy link
Contributor

khalwat commented Feb 23, 2022

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

No branches or pull requests

5 participants