feat: Added env var QRCODE_COLOR

This commit is contained in:
Davidson Gomes
2023-07-31 15:51:05 -03:00
parent aefe6a5943
commit b88656829e
6 changed files with 9 additions and 2 deletions

View File

@@ -105,7 +105,7 @@ export type GlobalWebhook = {
export type SslConf = { PRIVKEY: string; FULLCHAIN: string };
export type Webhook = { GLOBAL?: GlobalWebhook; EVENTS: EventsWebhook };
export type ConfigSessionPhone = { CLIENT: string; NAME: string };
export type QrCode = { LIMIT: number };
export type QrCode = { LIMIT: number; COLOR: string };
export type Production = boolean;
export interface Env {
@@ -245,6 +245,7 @@ export class ConfigService {
},
QRCODE: {
LIMIT: Number.parseInt(process.env.QRCODE_LIMIT) || 30,
COLOR: process.env.QRCODE_COLOR || '#198754',
},
AUTHENTICATION: {
TYPE: process.env.AUTHENTICATION_TYPE as 'jwt',

View File

@@ -122,6 +122,7 @@ CONFIG_SESSION_PHONE:
# Set qrcode display limit
QRCODE:
LIMIT: 30
COLOR: '#198754'
# Defines an authentication type for the api
# We recommend using the apikey because it will allow you to use a custom token,

View File

@@ -597,11 +597,13 @@ export class WAStartupService {
this.logger.verbose('Incrementing QR code count');
this.instance.qrcode.count++;
const color = this.configService.get<QrCode>('QRCODE').COLOR;
const optsQrcode: QRCodeToDataURLOptions = {
margin: 3,
scale: 4,
errorCorrectionLevel: 'H',
color: { light: '#ffffff', dark: '#198754' },
color: { light: '#ffffff', dark: color },
};
if (this.phoneNumber) {