Browse Source

plugin: Set LIGHTNINGD_PLUGIN env var inform plugins

It might be useful to take special precautions inside a plugin when
being run as a plugin (and not as a standalone executable). This env
var is just set so plugins can differentiate correctly. I don't unset
the variable since it shouldn't have any effect on `lightningd`
itself.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
plugin-7
Christian Decker 6 years ago
parent
commit
968aeac908
  1. 1
      lightningd/plugin.c

1
lightningd/plugin.c

@ -899,6 +899,7 @@ void plugins_init(struct plugins *plugins, const char *dev_plugin_debug)
plugins->pending_manifests = 0; plugins->pending_manifests = 0;
uintmap_init(&plugins->pending_requests); uintmap_init(&plugins->pending_requests);
setenv("LIGHTNINGD_PLUGIN", "1", 1);
/* Spawn the plugin processes before entering the io_loop */ /* Spawn the plugin processes before entering the io_loop */
list_for_each(&plugins->plugins, p, list) { list_for_each(&plugins->plugins, p, list) {
bool debug; bool debug;

Loading…
Cancel
Save