-
Notifications
You must be signed in to change notification settings - Fork 1
Feat/wna server #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feat/auth
Are you sure you want to change the base?
Feat/wna server #35
Conversation
4d7c708 to
227e07b
Compare
227e07b to
37786f7
Compare
|
|
||
| const adminLogger = createLogger('Admin'); | ||
|
|
||
| export const createAdminRouter = (): express.Router => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
those endpoints can be called by smartflows, can we make separate http server for it? We need to consider additional security layer here so no one can randomly stop instance
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
src/routes/admin.ts
Outdated
| }); | ||
|
|
||
| // Perform graceful shutdown after response is sent | ||
| setTimeout(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really dislike this setTimeout. Can you send SIGTERM and add event handler on it?
src/health/health.ts
Outdated
| }; | ||
| }; | ||
|
|
||
| const getOperatorInfo = async (timeoutMs: number = 5000): Promise<OperatorInfo | undefined> => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move it to different place and export as public method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
docs/env-vars.md
Outdated
| | `LOCAL_SOLUTIONS_PATH` | Path to locally hosted NodeRed solution flow files to be used when installing solutions using "local" prefix within WorkLogic field. | `string` | | | ||
| | `SS58_FORMAT` | SS58 Key Format. | `number` (_>0_) | `42` | | ||
| | `PRETTY_PRINT` | Should pretty print logs. If you plan to use Grafana or any other log tooling it's recommended to set it to false. | `'true' \| 'false'` | `'false'` | | ||
| | `LOG_FILE_PATH` | Full path to log file (e.g., /var/log/app.log or ./logs/app.log) | `string` | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If value is not provided it means that log file transport is disabled
src/health/health.ts
Outdated
| }; | ||
| }; | ||
|
|
||
| const getOperatorInfo = async (timeoutMs: number = 5000): Promise<OperatorInfo | undefined> => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of undefined please use null, it's more explicit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
src/health/health.ts
Outdated
| return { | ||
| id: solution.solutionId, | ||
| name, | ||
| status: 'Active', // Assume active if installed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use enum
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
src/health/health.ts
Outdated
| solutionGroups, | ||
| }; | ||
| } catch { | ||
| return undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at least print error so we know what is going on
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
src/node-red/red.ts
Outdated
| export const getAllInstalledSolutionsWithGroups = async (): Promise<InstalledSolutionDetails[]> => { | ||
| const tabNodes = await getTabNodes(); | ||
|
|
||
| const solutions: Array<InstalledSolutionDetails | null> = await Promise.all( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why you need Promise.all ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
src/util/logger.ts
Outdated
| return logPath; | ||
| }; | ||
|
|
||
| const ensureLogDir = (logPath: string): void => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ensureLogDirExists
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
| @@ -0,0 +1,46 @@ | |||
| import express from 'express'; | |||
| import { createLogger } from '../util/logger'; | |||
| import { getIsShuttingDown } from '../shutdown'; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you create a middleware that will not accept new requests?
It can be even applied to submit vote endpoint so we don't accept new votes in case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
No description provided.