📦 Add https to trails using the free letsencrypt tls certificates
This package is an implementation of node-letsencrypt in Trails framework.
It currently only works with
trailpack-hapi. Support for other webserver trailpacks will be added soon.
With yo :
npm install -g yo generator-trails yo trails:trailpack trailpack-letsencrypt
With npm (you will have to create config file manually) :
npm install --save trailpack-letsencrypt
Check that the letsencrypt config is loaded on index.js
// config/index.js...exportsletsencrypt =
// config/letsencrypt.js/*** Let's Encrypt configuration* (app.config.letsencrypt)** Configures Let's Encrypt for https** */moduleexports =/*** Register trails http routes (routes.js) for https*/registerTrailsRoutes: true/*** for https only set to true* http connections will be redirected*/requireHttps: false/*** List of domains to allow the certificate creation for*/domains: 'example.com' 'www.example.com' 'admin.example.com'/*** The port to bind the webserver to for https*/port: processenvTLSPORT || 443/*** Directory to save letsencrypt files in*/configDir: './letsencrypt'/*** Let's Encrypt environment* To use the production service use "production"* Please be aware of the rate limits of the production environment.* For testing, please consider to use "staging"*/environment: 'staging'/*** Do you agree to the the terms of service?* Then set this to true.* You'll find the legal documents here:*/agreeTos: false/*** email contact address for Let's Encrypt enquiries*/email: 'email@example.com'/*** enable debug messages from the letsenrypt module*/debug: false/*** https only routes*/routes:method: 'GET'path: '/helloHttps'handler: 'ViewController.helloWorld'