Compare commits

...

4 Commits

Author SHA1 Message Date
Cameron Clough deccb39c44
disable logging in uat too 2022-05-02 23:50:14 +01:00
Cameron Clough 128f8b4c91
sane logging for production 2022-05-02 23:49:52 +01:00
Cameron Clough 0b629806fc
move data dir in production 2022-05-02 23:44:33 +01:00
Adam Black f8f82df082
update production, linted (#5)
* Removed older 2fa/oauth code in favour
of reworking

* add user settings, add checkbox to share data on
/useradmin/overview page

* Add settings api, update models

* lint
2022-05-01 23:56:55 +01:00
6 changed files with 33 additions and 29 deletions

View File

@ -9,6 +9,10 @@ services:
ports:
- "80:80"
- "443:443"
logging:
options:
max-size: "200k"
max-file: "10"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
# See traefik/traefik.toml for static config
@ -28,9 +32,11 @@ services:
# Use the retropilot-server image from the GitHub Container Registry
image: ghcr.io/retropilot/retropilot-server:production
restart: unless-stopped
logging:
driver: none
volumes:
# Mount realdata dir to /realdata in the container
- ./realdata:/realdata
# Mount dir to /realdata in the container
- /home/retro-data/prod:/realdata
env_file:
- .env
labels:
@ -54,8 +60,10 @@ services:
# But run the worker script instead
command: npm run worker
restart: unless-stopped
logging:
driver: none
volumes:
- ./realdata:/realdata
- /home/retro-data/prod:/realdata
env_file:
- .env
labels:
@ -65,6 +73,10 @@ services:
watchtower:
# automatically update containers when new images are released
image: containrrr/watchtower
logging:
options:
max-size: "200k"
max-file: "10"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command: --interval 30 --label-enable

View File

@ -41,6 +41,8 @@ services:
# Use the retropilot-server image from the GitHub Container Registry
image: ghcr.io/retropilot/retropilot-server:main
restart: unless-stopped
logging:
driver: none
volumes:
# Mount realdata dir to /realdata in the container
- ./realdata:/realdata
@ -67,6 +69,8 @@ services:
# But run the worker script instead
command: npm run worker
restart: unless-stopped
logging:
driver: none
volumes:
- ./realdata:/realdata
env_file:

View File

@ -1,4 +1,3 @@
import authentication from './authentication';
import { Accounts } from '../../models';

View File

@ -7,8 +7,7 @@ export async function SetResearchStatus(userId, status) {
}
export async function GetResearchStatus(userId) {
return Accounts.findOne({where: {id: userId}, attributes: ['research_enabled']})
return Accounts.findOne({ where: { id: userId }, attributes: ['research_enabled'] });
}
export default null;

View File

@ -1,5 +1,4 @@
import express from 'express';
import log4js from 'log4js';
import admin from './admin';
import auth from './auth';

View File

@ -1,34 +1,25 @@
import bodyParser from 'body-parser';
import crypto from 'crypto';
import dirTree from 'directory-tree';
import express from 'express';
import log4js from 'log4js';
import { requireAuthenticated } from '../../../middlewares/authentication';
import { SetResearchStatus, GetResearchStatus } from '../../../controllers/user/settings';
const logger = log4js.getLogger();
// /api/devices
const router = express.Router();
router.patch('/research/:enabled', requireAuthenticated, async (req, res) => {
const { enabled } = req.params;
if (!enabled) { res.json({ bad: true }); }
const doEnable = enabled === 'true';
const accountId = req.account.id;
const update = await SetResearchStatus(req.account.id, doEnable);
return res.json({ success: true, data: req.account });
});
const { enabled } = req.params;
if (!enabled) { res.json({ bad: true }); }
const doEnable = enabled === 'true';
router.get('/research/', requireAuthenticated, async (req, res) => {
const accountId = req.account.id;
const update = await GetResearchStatus(req.account.id);
return res.json({ success: true, data: update });
});
await SetResearchStatus(req.account.id, doEnable);
return res.json({ success: true, data: req.account });
});
router.get('/research/', requireAuthenticated, async (req, res) => {
const update = await GetResearchStatus(req.account.id);
return res.json({ success: true, data: update });
});
export default router;