src/services/mailhog.ts   A
last analyzed

Complexity

Total Complexity 2
Complexity/F 1

Size

Lines of Code 31
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 22
mnd 0
bc 0
fnc 2
dl 0
loc 31
rs 10
bpm 0
cpm 1
noi 0
c 0
b 0
f 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A Mailhog.configure 0 5 1
A Mailhog.addNginxConfiguration 0 3 1
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