Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Vidéos
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Vidéos
Commits
b65c27aa
Commit
b65c27aa
authored
8 years ago
by
Chocobozzz
Browse files
Options
Downloads
Patches
Plain Diff
Server: check the host key is not present in configurations
The parameter was renamed to hostname
parent
763381de
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
server.js
+8
-3
8 additions, 3 deletions
server.js
server/initializers/checker.js
+14
-1
14 additions, 1 deletion
server/initializers/checker.js
with
22 additions
and
4 deletions
server.js
+
8
−
3
View file @
b65c27aa
...
@@ -26,9 +26,14 @@ database.connect()
...
@@ -26,9 +26,14 @@ database.connect()
// ----------- Checker -----------
// ----------- Checker -----------
const
checker
=
require
(
'
./server/initializers/checker
'
)
const
checker
=
require
(
'
./server/initializers/checker
'
)
const
miss
=
checker
.
checkConfig
()
const
missed
=
checker
.
checkMissedConfig
()
if
(
miss
.
length
!==
0
)
{
if
(
missed
.
length
!==
0
)
{
throw
new
Error
(
'
Miss some configurations keys :
'
+
miss
)
throw
new
Error
(
'
Miss some configurations keys :
'
+
missed
)
}
const
errorMessage
=
checker
.
checkConfig
()
if
(
errorMessage
!==
null
)
{
throw
new
Error
(
errorMessage
)
}
}
// ----------- PeerTube modules -----------
// ----------- PeerTube modules -----------
...
...
This diff is collapsed.
Click to expand it.
server/initializers/checker.js
+
14
−
1
View file @
b65c27aa
...
@@ -8,12 +8,25 @@ const User = mongoose.model('User')
...
@@ -8,12 +8,25 @@ const User = mongoose.model('User')
const
checker
=
{
const
checker
=
{
checkConfig
,
checkConfig
,
checkMissedConfig
,
clientsExist
,
clientsExist
,
usersExist
usersExist
}
}
//
Check the config
files
//
Some checks on configuration
files
function
checkConfig
()
{
function
checkConfig
()
{
if
(
config
.
has
(
'
webserver.host
'
))
{
let
errorMessage
=
'
`host` config key was renamed to `hostname` but it seems you still have a `host` key in your configuration files!
'
errorMessage
+=
'
Please ensure to rename your `host` configuration to `hostname`.
'
return
errorMessage
}
return
null
}
// Check the config files
function
checkMissedConfig
()
{
const
required
=
[
'
listen.port
'
,
const
required
=
[
'
listen.port
'
,
'
webserver.https
'
,
'
webserver.hostname
'
,
'
webserver.port
'
,
'
webserver.https
'
,
'
webserver.hostname
'
,
'
webserver.port
'
,
'
database.hostname
'
,
'
database.port
'
,
'
database.suffix
'
,
'
database.hostname
'
,
'
database.port
'
,
'
database.suffix
'
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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