Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
server
Manage
Activity
Members
Labels
Plan
Issues
25
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cokoapps
server
Commits
c82b1da4
Commit
c82b1da4
authored
9 months ago
by
Yannis Barlas
Browse files
Options
Downloads
Patches
Plain Diff
feat(*): add helpful error message for pubsweet config changes
parent
797ec71c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!123
v4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/errors/ConfigSchemaError.js
+10
-0
10 additions, 0 deletions
src/errors/ConfigSchemaError.js
src/startServer.js
+2
-0
2 additions, 0 deletions
src/startServer.js
src/startup/checkConfig.js
+19
-0
19 additions, 0 deletions
src/startup/checkConfig.js
with
31 additions
and
0 deletions
src/errors/ConfigSchemaError.js
0 → 100644
+
10
−
0
View file @
c82b1da4
class
ConfigSchemaError
extends
Error
{
constructor
(
message
)
{
super
(
message
)
this
.
name
=
'
ConfigSchemaError
'
this
.
message
=
`
${
message
}
`
}
}
module
.
exports
=
ConfigSchemaError
This diff is collapsed.
Click to expand it.
src/startServer.js
+
2
−
0
View file @
c82b1da4
...
...
@@ -13,6 +13,7 @@ const { migrate } = require('./dbManager/migrate')
const
seedGlobalTeams
=
require
(
'
./startup/seedGlobalTeams
'
)
const
ensureTempFolderExists
=
require
(
'
./startup/ensureTempFolderExists
'
)
const
{
runCustomStartupScripts
}
=
require
(
'
./startup/customScripts
'
)
const
checkConfig
=
require
(
'
./startup/checkConfig
'
)
let
server
...
...
@@ -23,6 +24,7 @@ const startServer = async (app = express()) => {
logInit
(
'
Coko server init tasks
'
)
checkConfig
()
await
ensureTempFolderExists
()
await
migrate
()
await
seedGlobalTeams
()
...
...
This diff is collapsed.
Click to expand it.
src/startup/checkConfig.js
0 → 100644
+
19
−
0
View file @
c82b1da4
const
config
=
require
(
'
config
'
)
const
{
logTask
}
=
require
(
'
../logger/internals
'
)
const
ConfigSchemaError
=
require
(
'
../errors/ConfigSchemaError
'
)
const
throwPubsweetKeyError
=
key
=>
{
throw
new
ConfigSchemaError
(
`The "
${
key
}
" key has been removed. Move all configuration that existed under "
${
key
}
" to the top level of your config.`
,
)
}
const
check
=
()
=>
{
logTask
(
'
Checking configuration
'
)
if
(
config
.
has
(
'
pubsweet
'
))
throwPubsweetKeyError
(
'
pubsweet
'
)
if
(
config
.
has
(
'
pubsweet-server
'
))
throwPubsweetKeyError
(
'
pubsweet=server
'
)
}
module
.
exports
=
check
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment