Total Complexity | 2 |
Complexity/F | 1 |
Lines of Code | 31 |
Function Count | 2 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import * as fs from 'fs' |
||
2 | import nginxMailhogConf from '../templates/nginx/mailhog' |
||
3 | import {getConfig, jaleNginxAppsPath} from '../utils/jale' |
||
4 | import Nginx from './nginx' |
||
5 | import Service from './service' |
||
6 | |||
7 | class Mailhog extends Service { |
||
8 | service = 'mailhog' |
||
9 | |||
10 | |||
11 | nginxConfigPath = `${jaleNginxAppsPath}/mailhog.conf` |
||
12 | |||
13 | configure = async (): Promise<boolean> => { |
||
14 | await this.addNginxConfiguration() |
||
15 | await (new Nginx).restart() |
||
16 | |||
17 | return true |
||
18 | } |
||
19 | |||
20 | /** |
||
21 | * Install the Mailhog Nginx configuration. |
||
22 | */ |
||
23 | addNginxConfiguration = async (): Promise<void> => { |
||
24 | const config = await getConfig() |
||
25 | return fs.writeFileSync(this.nginxConfigPath, nginxMailhogConf(config.tld)) |
||
26 | } |
||
27 | |||
28 | } |
||
29 | |||
30 | export default Mailhog |
||
31 |