Skip to content

Commit

Permalink
⚙️ LUA_SCRIPT & LOG_FILE env
Browse files Browse the repository at this point in the history
  • Loading branch information
bscheshirwork committed Mar 13, 2017
1 parent 16f401f commit 870bc0f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ exec /opt/mysql-proxy/bin/mysql-proxy \\\\\n\
--plugins=proxy \\\\\n\
--proxy-address=\${PROXY_DB_HOST}:\${PROXY_DB_PORT} \\\\\n\
--proxy-backend-addresses=\${REMOTE_DB_HOST}:\${REMOTE_DB_PORT} \\\\\n\
--proxy-lua-script=\${PROXY_LUA_SCRIPT}\n\
--proxy-lua-script=\${LUA_SCRIPT}\n\
" >> /opt/entrypoint.sh && \
chmod u+x /opt/entrypoint.sh
EXPOSE 4040 4041
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ services:
PROXY_DB_PORT: 3306
REMOTE_DB_HOST: mysql
REMOTE_DB_PORT: 3306
PROXY_LUA_SCRIPT: "/opt/mysql-proxy/conf/main.lua"
LUA_SCRIPT: "/opt/mysql-proxy/conf/main.lua"
depends_on:
- mysql
```
Expand All @@ -79,13 +79,14 @@ end
PROXY_DB_PORT: 3306
REMOTE_DB_HOST: mysql
REMOTE_DB_PORT: 3306
PROXY_LUA_SCRIPT: "/opt/mysql-proxy/conf/log.lua"
LUA_SCRIPT: "/opt/mysql-proxy/conf/log.lua"
LOG_FILE: "/opt/mysql-proxy/logs/mysql.log"
...
```

`/mysql-proxy/log.lua` https://gist.github.com/simonw/1039751
```
local log_file = '/opt/mysql-proxy/logs/mysql.log'
local log_file = os.getenv("LOG_FILE")
local fh = io.open(log_file, "a+")
Expand Down
2 changes: 1 addition & 1 deletion log.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
-- This script will log the current date and time, the connection id
-- and the query to a file named "mysql.log"
--
local log_file = '/opt/mysql-proxy/logs/mysql.log'
local log_file = os.getenv("LOG_FILE")

local fh = io.open(log_file, "a+")

Expand Down

0 comments on commit 870bc0f

Please sign in to comment.