Skip to content

Commit

Permalink
Merge pull request #3 from SecJS/feat/len-load-sync
Browse files Browse the repository at this point in the history
fix(global): remove loadSync from global and add path
  • Loading branch information
jlenon7 authored Nov 19, 2021
2 parents bd6e0eb + 543eb69 commit ce42578
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@secjs/config",
"version": "1.0.3",
"version": "1.0.4",
"description": "",
"license": "MIT",
"author": "João Lenon",
Expand Down
8 changes: 4 additions & 4 deletions src/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ export class Config {
return config
}

loadSync() {
loadSync(configPath = '/config') {
Config.loadEnvs()

const path = `${process.cwd()}/config`
const path = `${process.cwd()}/${configPath}`

const { files } = getFoldersSync(path, true)

Expand All @@ -53,10 +53,10 @@ export class Config {
return this
}

async load() {
async load(configPath = '/config') {
Config.loadEnvs()

const path = `${process.cwd()}/config`
const path = `${process.cwd()}/${configPath}`

const { files } = await getFolders(path, true)

Expand Down
2 changes: 0 additions & 2 deletions src/utils/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,5 @@ declare global {
}
}

new ConfigInstance().loadSync()

const _global = global as any
_global.Config = ConfigInstance

0 comments on commit ce42578

Please sign in to comment.