@@ -29,7 +29,7 @@ async function main() {
2929
3030 await sleep ( 1000 ) ;
3131 log . info ( 'I think everything has started up now' ) ;
32- const ports = process . env . HTTPS ? '80/443' : '80' ;
32+ const ports = [ 'manual' , 'auto' ] . includes ( process . env . HTTPS ) ? '80/443' : '80' ;
3333 log . info ( `Listening internally on ${ ports } , externally at ${ process . env . URL } ` ) ;
3434}
3535
@@ -63,14 +63,14 @@ function startGrist() {
6363function startTraefik ( ) {
6464 const flags = [ ] ;
6565 flags . push ( "--providers.file.filename=/settings/traefik.yaml" ) ;
66- flags . push ( "--entryPoints.web.address=:80" )
66+ flags . push ( "--entryPoints.web.address=:80" ) ;
6767
6868 if ( process . env . HTTPS === 'auto' ) {
6969 flags . push ( `--certificatesResolvers.letsencrypt.acme.email=${ process . env . EMAIL } ` )
7070 flags . push ( "--certificatesResolvers.letsencrypt.acme.storage=/persist/acme.json" )
7171 flags . push ( "--certificatesResolvers.letsencrypt.acme.tlschallenge=true" )
7272 }
73- if ( process . env . HTTPS ) {
73+ if ( [ 'auto' , 'manual' ] . includes ( process . env . HTTPS ) ) {
7474 flags . push ( "--entrypoints.websecure.address=:443" )
7575 // Redirect http -> https
7676 // See: https://doc.traefik.io/traefik/routing/entrypoints/#redirection
@@ -266,6 +266,12 @@ function prepareCertificateSettings() {
266266 if ( ! [ 'auto' , 'external' , 'manual' ] . includes ( https ) ) {
267267 throw new Error ( `HTTPS environment variable must be set to: auto, external, or manual.` ) ;
268268 }
269+ // If there is external HTTPS, something else will be in charge of
270+ // setting it up, so don't do it ourselves.
271+ if ( https === 'external' ) {
272+ return ;
273+ }
274+
269275 const tls = ( https === 'auto' ) ? '{ certResolver: letsencrypt }' :
270276 ( https === 'manual' ) ? 'true' : 'false' ;
271277 process . env . TLS = tls ;
0 commit comments