Skip to content

Commit

Permalink
Modificados test_config y config, #73
Browse files Browse the repository at this point in the history
  • Loading branch information
MarioGuisado committed Jan 5, 2024
1 parent a93c88a commit 052da68
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ import * as dotenv from 'dotenv';
import pino from 'pino';
import fs from 'fs';

dotenv.config({ debug: true });

export class Config {
private configValues: { [key: string]: string } = {
LOG_LEVEL: 'info',
LOG_FILE_PATH: './logs.log',
};

constructor() {
constructor(config?: { [key: string]: string }) {
for (const key in this.configValues) {
if (process.env[key]) {
if (!config && process.env[key]) {
dotenv.config({ debug: true });
this.configValues[key] = process.env[key]!;
} else {
const githubEnvVar = process.env[`GITHUB_ENV_${key}`];
Expand Down
2 changes: 0 additions & 2 deletions test/test_config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { expect } from 'chai';
import { Config } from '../src/config';
import * as dotenv from 'dotenv';
import * as fs from 'fs';

dotenv.config({ debug: true });

describe('Config & Logger', () => {
let config: Config;
Expand Down

0 comments on commit 052da68

Please sign in to comment.