(domainName: string, basicAuthPassword: string)
| 35 | } |
| 36 | |
| 37 | function writeCaddyfile(domainName: string, basicAuthPassword: string) { |
| 38 | const caddyfileTemplatePath = path.resolve( |
| 39 | __dirname, |
| 40 | 'caddy', |
| 41 | 'Caddyfile.template', |
| 42 | ); |
| 43 | const caddyfilePath = path.resolve(__dirname, 'caddy', 'Caddyfile'); |
| 44 | fs.writeFileSync( |
| 45 | caddyfilePath, |
| 46 | fs |
| 47 | .readFileSync(caddyfileTemplatePath, 'utf-8') |
| 48 | .replaceAll('$DOMAIN_NAME', domainName.replace(/https?:\/\//, '')) |
| 49 | .replaceAll( |
| 50 | '$BASIC_AUTH_PASSWORD', |
| 51 | bcrypt.hashSync(basicAuthPassword, 10), |
| 52 | ) |
| 53 | .replaceAll( |
| 54 | '$SSL_CONFIG', |
| 55 | domainName.includes('localhost:443') ? '\n\ttls internal' : '', |
| 56 | ), |
| 57 | ); |
| 58 | } |
| 59 | |
| 60 | export interface DockerComposeFile { |
| 61 | version: string; |
no test coverage detected