Necessary Pigeonholing Mechanism
Miss any of our Open RFC calls?Watch the recordings here! »

trailpack-letsencrypt

1.2.2 • Public • Published

trailpack-letsencrypt

Gitter NPM version NPM downloads Build status Dependency Status Code Climate

📦 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.

Intallation

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

Configuration

Enable letsencrypt

// config/main.js
 
  packs: [
    ...
    require('trailpack-letsencrypt')
  ],

Check that the letsencrypt config is loaded on index.js

// config/index.js
...
exports.letsencrypt = require('./letsencrypt')

Configure

// config/letsencrypt.js
 
/**
 * Let's Encrypt configuration
 * (app.config.letsencrypt)
 *
 * Configures Let's Encrypt for https
 *
 *  */
module.exports = {
 
  /**
  * 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: process.env.TLSPORT || 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: https://letsencrypt.org/docs/
   */
  agreeTos: false,
 
  /**
   * email contact address for Let's Encrypt enquiries
   */
  email: 'changme@example.com',
 
  /**
   * enable debug messages from the letsenrypt module
   */
  debug: false,
 
  /**
   * https only routes
   */
  routes: [
    {
      method: 'GET',
      path: '/helloHttps',
      handler: 'ViewController.helloWorld'
    }
  ]
 
}
 

License

MIT

Install

npm i trailpack-letsencrypt

DownloadsWeekly Downloads

0

Version

1.2.2

License

MIT

Homepage

trailsjs.io

Last publish

Collaborators

  • avatar