Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
siibra-explorer
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xiao Gui
siibra-explorer
Commits
75309009
Commit
75309009
authored
4 years ago
by
Xiao Gui
Browse files
Options
Downloads
Patches
Plain Diff
add support for redi username/password
parent
d39a2a78
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
deploy/saneUrl/index.js
+7
-2
7 additions, 2 deletions
deploy/saneUrl/index.js
with
7 additions
and
2 deletions
deploy/saneUrl/index.js
+
7
−
2
View file @
75309009
...
...
@@ -16,6 +16,9 @@ const {
REDIS_RATE_LIMITING_DB_EPHEMERAL_PORT_6379_TCP_ADDR
,
REDIS_RATE_LIMITING_DB_EPHEMERAL_PORT_6379_TCP_PORT
,
REDIS_USERNAME
,
REDIS_PASSWORD
,
HOSTNAME
,
DISABLE_LIMITER
,
}
=
process
.
env
...
...
@@ -24,12 +27,14 @@ const redisProto = REDIS_PROTO || REDIS_RATE_LIMITING_DB_EPHEMERAL_PORT_6379_TCP
const
redisAddr
=
REDIS_ADDR
||
REDIS_RATE_LIMITING_DB_EPHEMERAL_PORT_6379_TCP_ADDR
||
null
const
redisPort
=
REDIS_PORT
||
REDIS_RATE_LIMITING_DB_EPHEMERAL_PORT_6379_TCP_PORT
||
6379
const
redisURL
=
redisAddr
&&
`
${
redisProto
}
://
${
redisAddr
}
:
${
redisPort
}
`
const
userPass
=
`
${
REDIS_USERNAME
||
''
}${(
REDIS_PASSWORD
&&
(
'
:
'
+
REDIS_PASSWORD
))
||
''
}${
(
REDIS_USERNAME
||
REDIS_PASSWORD
)
&&
'
@
'
}
`
const
redisURL
=
redisAddr
&&
`
${
redisProto
}
://
${
userPass
}${
redisAddr
}
:
${
redisPort
}
`
const
limiter
=
new
RateLimit
({
windowMs
:
1
e3
*
5
,
max
:
5
,
//
...( redisURL ? { store: new RedisStore({ redisURL }) } : {} )
...(
redisURL
?
{
store
:
new
RedisStore
({
redisURL
})
}
:
{}
)
})
const
passthrough
=
(
_
,
__
,
next
)
=>
next
()
...
...
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