Skip to content

Commit

Permalink
Fix missing MYSQL-API parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Surface committed Dec 20, 2024
1 parent 04ef9be commit 357b1b4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions develop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ OPTIONS="
--env \"T_MYSQL_USER=$T_MYSQL_USER\" \
--env \"T_MYSQL_PASSWORD=$T_MYSQL_PASSWORD\" \
--env \"T_MYSQL_MULTI_PARTICIPANT_SCHEMA=$T_MYSQL_MULTI_PARTICIPANT_SCHEMA\" \
--env \"T_MYSQL_API_AUTH_USER=$T_MYSQL_API_AUTH_USER\" \
--env \"T_MYSQL_API_AUTH_PASSWORD=$T_MYSQL_API_AUTH_PASSWORD\" \
--volume $(pwd)/data/mysql/state:/mysql-module-state:delegated \
--volume $(pwd)/server/src/modules/mysql-js/conf.d:/etc/mysql/conf.d:delegated \
$OPTIONS
Expand Down
10 changes: 9 additions & 1 deletion server/src/mysql-api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@ var router = express.Router();
const basicAuth = require('express-basic-auth');
const dataGenerator = require('./data-generator.js')

try {
var authUser = process.env.T_MYSQL_API_AUTH_USER;
var authPassword = process.env.T_MYSQL_API_AUTH_PASSWORD;
} catch (err) {
console.log('Missing T_MYSQL_API_AUTH_USER or T_MYSQL_API_AUTH_PASSWORD environment variables');
return;
}

// Basic Authentication Middleware
const authMiddleware = basicAuth({
users: { [process.env.T_MYSQL_API_AUTH_USER]: process.env.T_MYSQL_API_AUTH_PASSWORD },
users: { [authUser]: authPassword },
challenge: true,
unauthorizedResponse: (req) => 'Unauthorized'
});
Expand Down
2 changes: 2 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ RUN_OPTIONS="
--env \"T_MYSQL_USER=$T_MYSQL_USER\" \
--env \"T_MYSQL_PASSWORD=$T_MYSQL_PASSWORD\" \
--env \"T_MYSQL_MULTI_PARTICIPANT_SCHEMA=$T_MYSQL_MULTI_PARTICIPANT_SCHEMA\" \
--env \"T_MYSQL_API_AUTH_USER=$T_MYSQL_API_AUTH_USER\" \
--env \"T_MYSQL_API_AUTH_PASSWORD=$T_MYSQL_API_AUTH_PASSWORD\" \
--volume $(pwd)/data/mysql/state:/mysql-module-state:delegated \
--volume $(pwd)/server/src/modules/mysql-js/conf.d:/etc/mysql/conf.d:delegated \
$RUN_OPTIONS
Expand Down

0 comments on commit 357b1b4

Please sign in to comment.