Skip to content

Commit

Permalink
Add subdomain
Browse files Browse the repository at this point in the history
  • Loading branch information
willnode committed Nov 23, 2024
1 parent d81b640 commit 9198e9b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "domcloud-bridge",
"version": "1.0.241123",
"version": "1.0.241124",
"description": "Deployment runner for DOM Cloud",
"main": "app.js",
"engines": {
Expand Down
3 changes: 2 additions & 1 deletion src/controllers/logman.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ export default function () {
try {
let type = req.query.type.toString()
let user = req.query.user.toString()
let sub = req.query.sub.toString()
let n = parseInt((req.query.n || 100).toString()) || 100;
let output = await logmanExec.getLog(user, type, n);
let output = await logmanExec.getLog(user, type, sub, n);
return res.json(output);
} catch (err) {
next(err);
Expand Down
13 changes: 9 additions & 4 deletions src/executor/logman.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,24 @@ class LogmanExecutor {
/**
* @param {string} user
* @param {string} type
* @param {string} sub
* @param {number} n
*/
async getLog(user, type, n) {
async getLog(user, type, sub, n) {
let home = `/home/${user}`;
if (sub) {
home += `/domains/${sub}`
}
switch (type) {
case 'access':
return await spawnSudoUtil("SHELL_SUDO", ["root",
"tail", "-n", n + '', `/home/${user}/logs/access_log`]);
"tail", "-n", n + '', `${home}/logs/access_log`]);
case 'error':
return await spawnSudoUtil("SHELL_SUDO", ["root",
"tail", "-n", n + '', `/home/${user}/logs/error_log`]);
"tail", "-n", n + '', `${home}/logs/error_log`]);
case 'php':
return await spawnSudoUtil("SHELL_SUDO", ["root",
"tail", "-n", n + '', `/home/${user}/logs/php_log`]);
"tail", "-n", n + '', `${home}/logs/php_log`]);
case 'proxfix':
return await spawnSudoUtil("SHELL_SUDO", ["root",
"tail", "-n", n + '', `/home/${user}/tmp/app.log`]);
Expand Down

0 comments on commit 9198e9b

Please sign in to comment.