@cryptotaxi247 / kubo / commits / 58e52f351

feat: make it possible to enable plugins with a build env variable

Steven Allen committed Feb 10, 2020 at 12:53 UTC 58e52f351de443bab0e3e73ae3f65c0182afcb7e
3 files changed +17 -2
docs/plugins.md
+7
@@ -127,6 +127,13 @@ To preload a go-ipfs plugin:
127 go-ipfs$ make build
128 ```
129
130 +You can also preload an in-tree but disabled-by-default plugin by adding it to
131 +the IPFS_PLUGINS variable. For example, to enable plugins foo, bar, and baz:
132 +
133 +```bash
134 +go-ipfs$ make build IPFS_PLUGINS="foo bar baz"
135 +```
136 +
137 ## Creating A Plugin
138
139 To create your own out-of-tree plugin, use the [example
plugin/loader/Rules.mk
+5 -2
@@ -1,10 +1,13 @@
1 include mk/header.mk
2
3 +IPFS_PLUGINS ?=
4 +export IPFS_PLUGINS
5 +
6 $(d)/preload.go: d:=$(d)
4 -$(d)/preload.go: $(d)/preload_list $(d)/preload.sh
7 +$(d)/preload.go: $(d)/preload_list $(d)/preload.sh ALWAYS
8 $(d)/preload.sh > $@
9 go fmt $@ >/dev/null
10
11 DEPS_GO += $(d)/preload.go
9 -
12 +
13 include mk/footer.mk
plugin/loader/preload.sh
+5
@@ -4,6 +4,11 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
4
5 to_preload() {
6 awk 'NF' "$DIR/preload_list" | sed '/^#/d'
7 + if [[ -n "$IPFS_PLUGINS" ]]; then
8 + for plugin in $IPFS_PLUGINS; do
9 + echo "$plugin github.com/ipfs/go-ipfs/plugin/plugins/$plugin *"
10 + done
11 + fi
12 }
13
14 cat <<EOL