Prepared license key

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.

Exporting the license key

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.

Importing the license key

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:

  • -l or --license is the encoded license key data you got from the export command or the license key you got from Postal Systems, but this value would be longer and multi-line

Set the license key on application startup

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"}