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
ef81062b
Commit
ef81062b
authored
9 months ago
by
Yannis Barlas
Browse files
Options
Downloads
Patches
Plain Diff
chore(*): check file storage config with joi validations
parent
da0471fa
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!123
v4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/startup/checkConfig.js
+48
-0
48 additions, 0 deletions
src/startup/checkConfig.js
with
48 additions
and
0 deletions
src/startup/checkConfig.js
+
48
−
0
View file @
ef81062b
...
...
@@ -26,13 +26,61 @@ const throwRemovedError = key => {
throw
new
ConfigSchemaError
(
`The "
${
key
}
" key has been removed.`
)
}
const
fileStorageRequired
=
errors
=>
{
if
(
errors
.
find
(
e
=>
e
.
local
.
key
===
'
fileStorage
'
&&
e
.
code
===
'
any.required
'
)
)
{
return
new
Error
(
'
fileStorage configuration is required when useFileStorage is true
'
,
)
}
return
errors
}
const
schema
=
Joi
.
object
({
fileStorage
:
Joi
.
when
(
'
useFileStorage
'
,
{
is
:
true
,
then
:
Joi
.
object
({
accessKeyId
:
Joi
.
string
().
required
(),
secretAccessKey
:
Joi
.
string
().
required
(),
bucket
:
Joi
.
string
().
required
(),
region
:
Joi
.
string
().
optional
(),
protocol
:
Joi
.
string
().
required
(),
host
:
Joi
.
string
().
required
(),
port
:
Joi
.
alternatives
().
try
(
Joi
.
string
(),
Joi
.
number
()).
required
(),
minioConsolePort
:
Joi
.
alternatives
()
.
try
(
Joi
.
string
(),
Joi
.
number
())
.
required
(),
s3ForcePathStyle
:
Joi
.
boolean
().
optional
(),
s3SeparateDeleteOperations
:
Joi
.
boolean
().
optional
(),
maximumWidthForSmallImages
:
Joi
.
alternatives
()
.
try
(
Joi
.
string
(),
Joi
.
number
())
.
optional
(),
maximumWidthForMediumImages
:
Joi
.
alternatives
()
.
try
(
Joi
.
string
(),
Joi
.
number
())
.
optional
(),
})
.
required
()
.
error
(
errors
=>
fileStorageRequired
(
errors
)),
otherwise
:
Joi
.
any
().
forbidden
().
messages
({
'
*
'
:
'
Cannot use file storage key when useFileStorage is false
'
,
}),
}),
logger
:
Joi
.
object
({
info
:
Joi
.
func
().
required
(),
debug
:
Joi
.
func
().
required
(),
error
:
Joi
.
func
().
required
(),
warn
:
Joi
.
func
().
required
(),
}).
optional
(),
useFileStorage
:
Joi
.
boolean
().
optional
(),
useJobQueue
:
Joi
.
boolean
().
optional
(),
})
const
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