-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/issuesDetails/routerAndController
- Loading branch information
Showing
27 changed files
with
505 additions
and
378 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,6 +130,8 @@ dist | |
.yarn/install-state.gz | ||
.pnp.* | ||
|
||
volume/cache | ||
|
||
# playwright | ||
/test-results/ | ||
/playwright-report/* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,6 @@ aws: { | |
redis: { | ||
secure: false, | ||
host: 'redis', | ||
port: '6379' | ||
port: 6379 | ||
} | ||
url: "http://localhost:8085" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import fs from 'fs' | ||
import _ from 'lodash' | ||
import yaml from 'js-yaml' | ||
import * as v from 'valibot' | ||
|
||
export const ConfigSchema = v.object({ | ||
port: v.pipe(v.integer(), v.minValue(1)), | ||
asyncRequestApi: v.object({ | ||
url: v.url(), | ||
port: v.pipe(v.integer(), v.minValue(1)), | ||
requestsEndpoint: v.pipe(v.string(), v.nonEmpty()), | ||
requestTimeout: v.number() | ||
}), | ||
maintenance: v.object({ | ||
serviceUnavailable: v.boolean(), | ||
upTime: v.pipe(v.string(), v.nonEmpty()) | ||
}), | ||
aws: v.object({ | ||
region: v.string(), | ||
bucket: v.string(), | ||
s3ForcePathStyle: v.boolean() | ||
}), | ||
redis: v.optional( | ||
v.object({ | ||
secure: v.boolean(), | ||
host: v.pipe(v.string(), v.nonEmpty()), | ||
port: v.number() | ||
}) | ||
), | ||
url: v.url(), | ||
serviceName: v.pipe(v.string(), v.nonEmpty()), | ||
feedbackLink: v.url(), | ||
email: v.object({ | ||
templates: v.object({ | ||
RequesetTemplateId: v.uuid(), | ||
AcknowledgementTemplateId: v.uuid() | ||
}), | ||
dataManagementEmail: v.pipe(v.string(), v.email()) | ||
}) | ||
}) | ||
|
||
const readConfig = (config) => { | ||
console.assert(config, 'config not specified') | ||
return yaml.load(fs.readFileSync(`./config/${config}.yaml`, 'utf8')) | ||
} | ||
|
||
/** | ||
* Reads configs from disk, based on env variables | ||
* when 'environment' option not specified. | ||
* | ||
* @returns {Object} | ||
*/ | ||
export function combineConfigs (environment) { | ||
console.assert(environment, 'environment not specified') | ||
const defaultConfig = readConfig('default') | ||
const customConfig = readConfig(environment) | ||
return _.merge({}, defaultConfig, customConfig) | ||
} | ||
|
||
export const validateConfig = (config) => { | ||
try { | ||
return v.parse(ConfigSchema, config) | ||
} catch (error) { | ||
console.error('invalid config', error.message) | ||
for (const issue of error.issues) { | ||
console.info( | ||
`issue under path: [${issue.path.map((elem) => elem.key).join(', ')}]` | ||
) | ||
} | ||
throw error | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,5 @@ asyncRequestApi: { | |
redis: { | ||
secure: false, | ||
host: 'localhost', | ||
port: '6379' | ||
port: 6379 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.