Open webmasterkai opened 6 years ago
Having it be global state to the server would allow setting values for things like the port(s) that the HTTP server is using so the net-relay
plugin doesn't try to bind itself to a port that is already in use. This will also allow the plugin to update its schema to prevent values that are invalid.
Found some server app state stuff in /lib/config/config.js
. I might take a stab at collecting the various process.env and path creating functions and make a single object that can be used for debugging. I'd love have a single API endpoint that could be used by users to copy and paste full configuration and options into issues. It'd also be helpful to have a listing of values available in the admin UI. Making it clear the paths where settings
, defaults
, plugin-config-data
and the multiplexed logs
are all saved would be helpful.
Consider including a way to download everything as a zip file.
Or uploading to the cloud somewhere
Not all installations have connectivity, download & send would be more universal.
There is probably an express thing to gzip static responses. I know there is state persistence handlers for Redux. Save to file on server and then provide download link. Is server compression of file transfer sufficient?
I am not after compression, but a single file instead of multiple.
I'd like to see a consolidated state manager for the server. Eventually used by all server components.
Start with Plugin state
I think the easiest place to start is related to server plugins. Currently
app
includes some methods for plugins to use that could be used by the server to capture and save plugin state.debug()
error()
registerActionHandler()
on()
emit()
removeListener()
savePluginOptions()
These could be expanded to enable plugins to be completely stateless functions that utilized server state exclusively for getting and setting state.
It would enable plugins to define what events, ports, sockets they are listening on or emitting on. In this way other plugins and the server will know what is in use.
For each of these I was thinking it would be nice to have a human friendly name or description explaining what the plugin is emitting and what format (0183, N2K, SK, String, Buffer) it is in.
For example
aisreporter
could do something like:It would enable a dependency relationship between plugins. Now another plugin (
net-relay
) that handles emitting over UDP can provide a list of events that are being emitted to the user in the Admin UI. User can selectselfAis
and see that it isSelf Vessel AIS Messages
inNMEA0183
format. They then can assign a UDP hostname and port to emit those events to.The
net-relay
plugin could do something like:Now on the
aisreporter
UI we can show that there is a pluginnet-relay
listening to theselfAis
event and what is doing with it. Plugin dependency can now show user warning before disablingaisreporter
.More Plugin Instance State
A plugin might have more than one "instance". Perhaps it has attached itself to more than one socket.
id
- Plugin instance ID.socketId
- (string) This plugin instance is responsible for managing the socketId.listening
- (bool) Successfully listening.started
- (bool) Plugin is started and running.stopped
- (bool) Plugin has stopped for some reason.hasError
- (bool) The plugin has an error.errorMsg
- (string) Latest error message.Proposal
I'd like to use Redux to store JSON serializable data and a custom data store that keeps references to functions and classes.
Potentially related to #466, #449, #422, #412, #409, #408.