1
0
mirror of https://github.com/craigerl/aprsd.git synced 2024-12-20 16:41:13 -05:00

Change ordering of starting up of server command

This patch moves the plugin manager to early in the startup
process so that the plugins get loaded, which also means each
plugin's custom config settings will be in the CONF object.
This allows dumping the entire CONF with all the plugin settings.
This commit is contained in:
Hemna 2022-12-29 14:15:56 -05:00
parent 473f00973b
commit 83d2e708eb
3 changed files with 17 additions and 11 deletions

View File

@ -44,11 +44,21 @@ def server(ctx, flush):
LOG.info(msg) LOG.info(msg)
LOG.info(f"APRSD Started version: {aprsd.__version__}") LOG.info(f"APRSD Started version: {aprsd.__version__}")
CONF.log_opt_values(LOG, logging.DEBUG)
# Initialize the client factory and create # Initialize the client factory and create
# The correct client object ready for use # The correct client object ready for use
client.ClientFactory.setup() client.ClientFactory.setup()
# Create the initial PM singleton and Register plugins
# We register plugins first here so we can register each
# plugins config options, so we can dump them all in the
# log file output.
LOG.info("Loading Plugin Manager and registering plugins")
plugin_manager = plugin.PluginManager()
plugin_manager.setup_plugins()
# Dump all the config options now.
CONF.log_opt_values(LOG, logging.DEBUG)
# Make sure we have 1 client transport enabled # Make sure we have 1 client transport enabled
if not client.factory.is_client_enabled(): if not client.factory.is_client_enabled():
LOG.error("No Clients are enabled in config.") LOG.error("No Clients are enabled in config.")
@ -59,16 +69,16 @@ def server(ctx, flush):
sys.exit(-1) sys.exit(-1)
# Creates the client object # Creates the client object
LOG.info("Creating client connection") # LOG.info("Creating client connection")
client.factory.create().client # client.factory.create().client
# Now load the msgTrack from disk if any # Now load the msgTrack from disk if any
packets.PacketList() packets.PacketList()
if flush: if flush:
LOG.debug("Deleting saved MsgTrack.") LOG.debug("Deleting saved MsgTrack.")
packets.PacketTrack().flush() packets.PacketTrack().flush()
packets.WatchList() packets.WatchList().flush()
packets.SeenList() packets.SeenList().flush()
else: else:
# Try and load saved MsgTrack list # Try and load saved MsgTrack list
LOG.debug("Loading saved MsgTrack object.") LOG.debug("Loading saved MsgTrack object.")
@ -76,10 +86,6 @@ def server(ctx, flush):
packets.WatchList().load() packets.WatchList().load()
packets.SeenList().load() packets.SeenList().load()
# Create the initial PM singleton and Register plugins
LOG.info("Loading Plugin Manager and registering plugins")
plugin_manager = plugin.PluginManager()
plugin_manager.setup_plugins()
rx_thread = rx.APRSDPluginRXThread( rx_thread = rx.APRSDPluginRXThread(
packet_queue=threads.packet_queue, packet_queue=threads.packet_queue,

View File

@ -137,6 +137,7 @@ enabled_plugins_opts = [
"aprsd.plugins.time.TimePlugin", "aprsd.plugins.time.TimePlugin",
"aprsd.plugins.weather.OWMWeatherPlugin", "aprsd.plugins.weather.OWMWeatherPlugin",
"aprsd.plugins.version.VersionPlugin", "aprsd.plugins.version.VersionPlugin",
"aprsd.plugins.notify.NotifySeenPlugin",
], ],
help="Comma separated list of enabled plugins for APRSD." help="Comma separated list of enabled plugins for APRSD."
"To enable installed external plugins add them here." "To enable installed external plugins add them here."

View File

@ -9,7 +9,6 @@ email_group = cfg.OptGroup(
email_opts = [ email_opts = [
cfg.StrOpt( cfg.StrOpt(
"callsign", "callsign",
required=True,
help="(Required) Callsign to validate for doing email commands." help="(Required) Callsign to validate for doing email commands."
"Only this callsign can check email. This is also where the " "Only this callsign can check email. This is also where the "
"email notifications for new emails will be sent.", "email notifications for new emails will be sent.",