Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
A
augustctl
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Code Review
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
open-source
augustctl
Commits
61e0cfa7
Verified
Commit
61e0cfa7
authored
Aug 27, 2016
by
Erick Hitter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial implementation of caching, to prevent lock DDoS and the need to restart the server
parent
b272e122
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
package.json
package.json
+2
-1
server.js
server.js
+3
-1
No files found.
package.json
View file @
61e0cfa7
...
...
@@ -20,7 +20,8 @@
"
express
"
:
"
^4.13.3
"
,
"
morgan
"
:
"
^1.6.1
"
,
"
noble
"
:
"
^1.1.0
"
,
"
asyncawait
"
:
"
^0.7.4
"
"
asyncawait
"
:
"
^0.7.4
"
,
"
apicache
"
:
"
*
"
},
"repository"
:
{
"type"
:
"git"
,
...
...
server.js
View file @
61e0cfa7
...
...
@@ -5,6 +5,8 @@ var express = require( 'express' );
var
morgan
=
require
(
'
morgan
'
);
var
await
=
require
(
'
asyncawait/await
'
);
var
async
=
require
(
'
asyncawait/async
'
);
var
apicache
=
require
(
'
apicache
'
).
options
(
{
defaultDuration
:
30000
}
);
var
cache
=
apicache
.
middleware
;
var
config
=
require
(
process
.
env
.
AUGUSTCTL_CONFIG
||
'
./config.json
'
);
var
serverConfig
=
require
(
process
.
env
.
AUGUSTCTL_SERVER_CONFIG
||
'
./server-config.json
'
);
...
...
@@ -24,7 +26,7 @@ var ret = {
};
// Endpoint to perform all lock actions
app
.
get
(
'
/api/:lock_action/:lock_name
'
,
function
(
req
,
res
)
{
app
.
get
(
'
/api/:lock_action/:lock_name
'
,
cache
(
'
5 seconds
'
),
function
(
req
,
res
)
{
// Parse allowed request arguments
var
action
=
req
.
params
.
lock_action
,
allowedActions
=
[
'
unlock
'
,
'
lock
'
,
'
status
'
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment