Sign inSign up

savignano/license3j-server

By savignano

•Updated about 1 hour ago

License Server based on license3j

Image
Developer tools
0

10K+

savignano/license3j-server repository overview

⁠license3j-server Docker Image

Container image for the License Server application based on license3j project⁠.

Currently designed to work with FastSpring requests only.

⁠Quick start

docker run --rm -p 8090:8090 \
  -e FASTSPRING_FULFILLMENT_USERNAME=fastspring \
  -e FASTSPRING_FULFILLMENT_PASSWORD=changeme \
  -e FASTSPRING_FULFILLMENT_PRIVATEKEY=fastspring_hashkey \
  -e FASTSPRING_WEBHOOK_SECRET=fastspring_hmac \
  -v /etc/license3j-server/secrets/license3j-signkey.txt:/run/secrets/license3j-signkey.txt:ro \
  savignano/license3j-server:latest

Health endpoint:

http://localhost:8090/health

⁠Config volume merge behavior

Image defaults from docker/context/license3j-server/config/ are baked into /opt/license3j-server/config-defaults in the container.

At startup, missing files are copied into /opt/license3j-server/config:

cp -an /opt/license3j-server/config-defaults/. /opt/license3j-server/config/

So you can mount a config directory and keep your overrides while still getting new default files:

docker run --rm -p 8090:8090 \
  -v /etc/license3j-server/config:/opt/license3j-server/config \
  savignano/license3j-server:latest

⁠Environment variables

VariableDefaultDescription
SERVER_PORT8090HTTP server port
SIGNKEY_FILE(required)Path to license3j signing key
LICENSE_EXPIRY_DAYS365Default license expiry in days to be used when ca_expiryDays is not set
FASTSPRING_FULFILLMENT_PRIVATEKEY(required)FastSpring security_request_hash private key from Remote Server Request Configuration
FASTSPRING_FULFILLMENT_USERNAME(required)Basic Auth username for fulfillment endpoint
FASTSPRING_FULFILLMENT_PASSWORD(required)Basic Auth password for fulfillment endpoint
FASTSPRING_WEBHOOK_SECRET(required)FastSpring webhook HMAC secret from Webhook Configuration
MAIL_ENABLEDfalseSet to true to enable webhook email sending
MAIL_SMTP_HOSTlocalhostSMTP server host
MAIL_SMTP_PORT587SMTP server port
MAIL_SMTP_STARTTLStrueEnable STARTTLS
MAIL_SMTP_USERNAME(required if mail enabled)SMTP username
MAIL_SMTP_PASSWORD(required if mail enabled)SMTP password
MAIL_FROM(required if mail enabled)Sender address
WELCOME_TEMPLATE_FILE/opt/license3j-server/config/welcome-email.vmFilesystem path to welcome email template. Falls back to classpath default if not found
CHARGE_COMPLETED_TEMPLATE_FILE/opt/license3j-server/config/charge-completed-email.vmFilesystem path to renewal email template. Falls back to classpath default if not found

⁠Webhook event handlers

Which webhook events trigger an email is configured in application.yml under licenseserver.webhook.event-handlers. Each handler has:

SettingDescription
event-typeFastSpring webhook event type to handle (e.g. subscription.activated)
subject-templateEmail subject line (Velocity syntax, has access to $data)
template-nameClasspath template name in templates/{name}.vm
template-fileOptional filesystem path override for the template (env var, e.g. ${WELCOME_TEMPLATE_FILE:})
recipient-pathDot-notation path to recipient email in webhook data (default: account.contact.email)
enabledSet to false to disable this handler without removing it (default: true)

Default configuration handles two events:

  • subscription.activated — sends a welcome email (template: welcome-email.vm)
  • subscription.charge.completed — sends a renewal email with the license key (template: charge-completed-email.vm)

All other webhook events are logged and skipped.

⁠Custom configuration

To customize event handlers (add/remove webhook events), mount a custom application.yml next to the JAR:

docker run ... \
  -v /path/to/my-application.yml:/opt/license3j-server/app/application.yml:ro \
  savignano/license3j-server:latest

Your file only needs to contain the properties you want to override — everything else falls back to defaults.

Note: event-handlers is a list, so defining it in your custom file replaces the whole thing. Copy the defaults below and extend from there.

licenseserver:
  webhook:
    event-handlers:
      - event-type: subscription.activated
        subject-template: "Welcome to $!{data.display}"
        template-name: welcome-email
        template-file: ${WELCOME_TEMPLATE_FILE:}
        recipient-path: account.contact.email
      - event-type: subscription.charge.completed
        subject-template: "Your $!{data.subscription.display} license renewal"
        template-name: charge-completed-email
        template-file: ${CHARGE_COMPLETED_TEMPLATE_FILE:}
        recipient-path: account.contact.email

⁠Velocity template variables

Both subject-template and the body template (.vm file) are rendered with Apache Velocity⁠. The following variables are available:

VariableTypeDescription
$dataMapThe full webhook event data payload as a nested Map. Access any field via dot notation
$eventTypeStringThe webhook event type (e.g. subscription.activated)

Common $data paths (exact fields depend on event type):

PathDescription
$data.account.contact.emailCustomer email
$data.account.contact.firstCustomer first name
$data.account.contact.lastCustomer last name
$data.displayProduct display name (subscription.activated)
$data.initialOrderReferenceOrder reference (subscription.activated)
$data.subscriptionSubscription ID string (subscription.activated)
$data.order.referenceOrder reference (subscription.charge.completed)
$data.subscription.displayProduct display name (subscription.charge.completed)
$data.order.itemsList of order items with fulfillments (subscription.charge.completed)

Use $!data.field (with !) to render an empty string instead of literal $data.field when the value is null.

Tag summary

Content type

Image

Digest

sha256:5e095110c…

Size

115.2 MB

Last updated

about 1 hour ago

docker pull savignano/license3j-server:nightly