Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions solidity/ts/testsuite/simulator/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as funtypes from 'funtypes'

type Config = funtypes.Static<typeof Config>
const Config = funtypes.ReadonlyObject({
testRPCEndpoint: funtypes.String.withConstraint(URL.canParse)
testRPCEndpoint: funtypes.String.withConstraint(URL.canParse)
})

const UserConfig = funtypes.Partial(Config.fields)
Expand All @@ -15,14 +15,14 @@ export const defaultConfig = Config.parse(JSON.parse(await fs.readFile(defaultCo
export const userConfig = (await fileExists(userConfigLocation)) ? UserConfig.parse(JSON.parse(await fs.readFile(userConfigLocation, 'utf8'))) : {}

export function getConfig() {
return { ...defaultConfig, ...userConfig }
return { ...defaultConfig, ...userConfig }
}

async function fileExists(path: string): Promise<boolean> {
try {
await fs.access(path, fs.constants.F_OK)
return true
} catch (error) {
return false
}
}
try {
await fs.access(path, fs.constants.F_OK)
return true
} catch (error) {
return false
}
}