File size: 886 Bytes
4327358
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { WhatsappConfigService } from '@waha/config.service';
import { BootstrapConfig } from '@waha/core/engines/gows/GowsBootstrap';
import { GowsConfig } from '@waha/core/engines/gows/session.gows.core';

@Injectable()
export class GowsEngineConfigService {
  constructor(
    protected configService: ConfigService,
    protected whatsappConfigService: WhatsappConfigService,
  ) {}

  getBootstrapConfig(): BootstrapConfig {
    return {
      path: this.configService.get('WAHA_GOWS_PATH'),
      socket: this.getSocket(),
      pprof: this.whatsappConfigService.debugModeEnabled,
    };
  }

  getSocket() {
    return this.configService.get('WAHA_GOWS_SOCKET', '/tmp/gows.sock');
  }

  getConfig(): GowsConfig {
    return {
      connection: 'unix:' + this.getSocket(),
    };
  }
}