-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #303 from 3scale/redis-url
[redis] allow configuration via REDIS_URL
- Loading branch information
Showing
8 changed files
with
110 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
env REDIS_HOST; | ||
env REDIS_PORT; | ||
env REDIS_URL; | ||
env RESOLVER; | ||
env BACKEND_ENDPOINT_OVERRIDE; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env sh | ||
|
||
exec resty -I apicast/src script/redis.lua "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env resty -I apicast/src | ||
|
||
local cmd = arg[1] | ||
local args = {} | ||
|
||
for i=2, #arg do | ||
table.insert(args, arg[i]) | ||
end | ||
|
||
if not cmd then | ||
print('missing command') | ||
print('usage: ' .. arg[0] .. ' cmd [arg [arg ...]]') | ||
os.exit(1) | ||
end | ||
|
||
local inspect = require 'inspect' | ||
local ts = require 'threescale_utils' | ||
|
||
local red, err = ts.connect_redis() | ||
|
||
if not red and err then | ||
print('could not connect to redis: ', err) | ||
os.exit(1) | ||
end | ||
|
||
local fn = red[cmd] | ||
local res, err = fn(red, unpack(args)) | ||
|
||
if err then | ||
print('error: ', err) | ||
print(inspect(r)) | ||
os.exit(1) | ||
end | ||
|
||
print(inspect(res)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters