All files / src/config envService.ts

100% Statements 31/31
100% Branches 0/0
100% Functions 1/1
100% Lines 29/29

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 12714x 14x       14x                                                                                                     137x 137x   137x   137x       137x       137x       137x       137x   137x 137x 137x       137x 137x 137x 137x   137x       137x 137x       137x       137x       137x         137x         137x   137x   137x   137x      
import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { bool } from 'aws-sdk/clients/signer';
 
@Injectable()
export class EnvironmentService {
  deviceTableName: string;
 
  siteTableName: string;
 
  modelSerialGsi: string;
 
  transactionGsi: string;
 
  accessTokenGsi: string;
 
  entityUuidGsi: string;
 
  siteUuidGsi: string;
 
  auth0ClientKey: string;
 
  auth0ClientSecret: string;
 
  auth0Audience: string;
 
  auth0ManagementAudience: string;
 
  auth0JwtMaxAge: string;
 
  auth0JwtIssuer: string;
 
  auth0UrlTenant: string;
 
  auth0UrlCreateUser: string;
 
  auth0UrlGetToken: string;
 
  auth0UrlJwtWellKnown: string;
 
  auth0UrlForgotPwd: string;
 
  auth0UrlChangePwd: string;
 
  auth0UrlRevokeToken: string;
 
  appSyncEndpoint: string;
 
  awsRegion: string;
 
  iamUserKey: string;
 
  iamUserSecret: string;
 
  isInLambda: bool;
 
  constructor(private readonly configService: ConfigService) {
    this.deviceTableName = this.configService.get('DEVICE_TABLE', 'Devices');
 
    this.siteTableName = this.configService.get('SITE_TABLE', 'Sites');
 
    this.modelSerialGsi = this.configService.get(
      'DEVICE_MODELSERIAL_GSI',
      'modelSerialGsi',
    );
    this.transactionGsi = this.configService.get(
      'TRANSACTION_GSI',
      'transactionGsi',
    );
    this.accessTokenGsi = this.configService.get(
      'ACCESS_TOKEN_GSI',
      'accessTokenGsi',
    );
    this.entityUuidGsi = this.configService.get(
      'ENTITY_UUID_GSI',
      'entityUuidGsi',
    );
    this.siteUuidGsi = this.configService.get('SITE_UUID_GSI', 'siteUuidGsi');
 
    this.auth0ClientKey = this.configService.get('AUTH0_CLIENT_ID', '');
    this.auth0ClientSecret = this.configService.get('AUTH0_CLIENT_SECRET', '');
    this.auth0ManagementAudience = this.configService.get(
      'AUTH0_MANAGEMENT_AUDIENCE',
      '',
    );
    this.auth0Audience = this.configService.get('AUTH0_AUDIENCE', '');
    this.auth0UrlTenant = this.configService.get('AUTH0_TENANT', '');
    this.auth0JwtMaxAge = this.configService.get('AUTH0_JWT_MAX_AGE', '');
    this.auth0JwtIssuer = this.configService.get('AUTH0_JWT_ISSUER', '');
 
    this.auth0UrlCreateUser = this.configService.get(
      'AUTH0_PATH_CREATE_USER',
      '',
    );
    this.auth0UrlGetToken = this.configService.get('AUTH0_PATH_GET_TOKEN', '');
    this.auth0UrlJwtWellKnown = this.configService.get(
      'AUTH0_PATH_JWT_WELLKNOWN',
      '',
    );
    this.auth0UrlForgotPwd = this.configService.get(
      'AUTH0_PATH_FORGOT_PWD',
      '',
    );
    this.auth0UrlChangePwd = this.configService.get(
      'AUTH0_PATH_CHANGE_PWD',
      '',
    );
    this.auth0UrlRevokeToken = this.configService.get(
      'AUTH0_PATH_REVOKE_TOKEN',
      '',
    );
 
    this.appSyncEndpoint = this.configService.get(
      'APP_SYNC_ENDPOINT',
      '',
    );
 
    this.awsRegion = this.configService.get('AWS_REGION', '');
 
    this.iamUserKey = this.configService.get('IAM_USER_KEY', '');
 
    this.iamUserSecret = this.configService.get('IAM_USER_SECRET', '');
 
    this.isInLambda = !!this.configService.get('LAMBDA_TASK_ROOT', '');
  }
}