diff --git a/cyphernodeconf_docker/prompters/030_traefik.js b/cyphernodeconf_docker/prompters/030_traefik.js index 7561e97..086ae3b 100644 --- a/cyphernodeconf_docker/prompters/030_traefik.js +++ b/cyphernodeconf_docker/prompters/030_traefik.js @@ -2,12 +2,41 @@ const chalk = require('chalk'); const name = 'traefik'; +const capitalise = function( txt ) { + return txt.charAt(0).toUpperCase() + txt.substr(1); +}; + +const prefix = function() { + return chalk.green(capitalise(name)+': '); +}; + module.exports = { name: function() { return name; }, prompts: function( utils ) { - return []; + return [ + { + type: 'input', + name: 'traefik_http_port', + default: utils.getDefault( 'traefik_http_port' ), + message: prefix()+'The HTTP port your apps will be accessible to the internet on.'+utils.getHelp('traefik_http_port'), + filter: utils.trimFilter, + validate: function( port ) { + return utils.notEmptyValidator( port ) && !isNaN( parseInt(port) ) + } + }, + { + type: 'input', + name: 'traefik_https_port', + default: utils.getDefault( 'traefik_https_port' ), + message: prefix()+'The HTTPS port your apps will be accessible to the internet on.'+utils.getHelp('traefik_https_port'), + filter: utils.trimFilter, + validate: function( port ) { + return utils.notEmptyValidator( port ) && !isNaN( parseInt(port) ) + } + } + ]; }, templates: function( props ) { return [ 'acme.json', 'traefik.toml', 'htpasswd' ]; diff --git a/cyphernodeconf_docker/templates/traefik/traefik.toml b/cyphernodeconf_docker/templates/traefik/traefik.toml index 0b6d48c..66bda92 100644 --- a/cyphernodeconf_docker/templates/traefik/traefik.toml +++ b/cyphernodeconf_docker/templates/traefik/traefik.toml @@ -5,11 +5,11 @@ defaultEntryPoints = ["https","http"] [entryPoints] [entryPoints.http] - address = ":80" + address = ":<%= traefik_http_port %>" [entryPoints.http.redirect] entryPoint = "https" [entryPoints.https] - address = ":443" + address = ":<%= traefik_https_port %>" [entryPoints.https.tls] [retry]