While you can set the license key using the administration interface, there are cases you might want to do this programmatically without manual intervention.
We can use the EmailEngine CLI to handle the license key in these cases.
Set up the license key programmatically
While you can set the license key using the administration interface, there are cases you might want to do this programmatically without manual intervention.
We can use the EmailEngine CLI to handle the license key in these cases.
Using the EmailEngine CLI, you can export the license as a single-line encoded string.
--dbs.redis
argument is used as an example. Without proper database settings, you would be exporting the license data from a wrong place.
$ emailengine license export --dbs.redis="redis://localhost:6379"
i0-AgqFsxFWFoWvEDGC7UN0krkiX_UkBn6FuslBvc...
EmailEngine returns encoded token data that we can either import to another EmailEngine instance via the CLI or use as a predefined license key set on application startup.
You can import the exported license key similarly as You exported it.
In this example, I'll be omitting database settings, but you still would have to provide it.
$ emailengine license import -l i0-AgqFsxFWFoWvEDGC7UN0krkiX_UkBn6FuslBvc...
License key was imported
Where:
We can also load the license key as a predefined value via the EENGINE_PREPARED_LICENSE
environment variable:
$ export EENGINE_PREPARED_LICENSE=i0-AgqFsxFWFoWvEDGC7...
$ emailengine
...
{"level":30,"time":1639517442546,"pid":30649,"hostname":"andrismacbook.lan","msg":"Imported license key","source":"import"}
Or use the command-line argument --preparedLicense
:
$ emailengine --preparedLicense="i0-AgqFsxFWFoWvEDGC7...."
...
{"level":30,"time":1639517517937,"pid":30673,"hostname":"andrismacbook.lan","msg":"Imported license key","source":"import"}