Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
58e52f35
Commit
58e52f35
authored
Feb 10, 2020
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: make it possible to enable plugins with a build env variable
parent
0ab1fa18
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
2 deletions
+17
-2
docs/plugins.md
docs/plugins.md
+7
-0
plugin/loader/Rules.mk
plugin/loader/Rules.mk
+5
-2
plugin/loader/preload.sh
plugin/loader/preload.sh
+5
-0
No files found.
docs/plugins.md
View file @
58e52f35
...
@@ -127,6 +127,13 @@ To preload a go-ipfs plugin:
...
@@ -127,6 +127,13 @@ To preload a go-ipfs plugin:
go-ipfs
$
make build
go-ipfs
$
make build
```
```
You can also preload an in-tree but disabled-by-default plugin by adding it to
the IPFS_PLUGINS variable. For example, to enable plugins foo, bar, and baz:
```
bash
go-ipfs
$
make build
IPFS_PLUGINS
=
"foo bar baz"
```
## Creating A Plugin
## Creating A Plugin
To create your own out-of-tree plugin, use the
[
example
To create your own out-of-tree plugin, use the
[
example
...
...
plugin/loader/Rules.mk
View file @
58e52f35
include
mk/header.mk
include
mk/header.mk
IPFS_PLUGINS
?=
export
IPFS_PLUGINS
$(d)/preload.go
:
d:=$(d)
$(d)/preload.go
:
d:=$(d)
$(d)/preload.go
:
$(d)/preload_list $(d)/preload.sh
$(d)/preload.go
:
$(d)/preload_list $(d)/preload.sh
ALWAYS
$(d)
/preload.sh
>
$@
$(d)
/preload.sh
>
$@
go
fmt
$@
>
/dev/null
go
fmt
$@
>
/dev/null
DEPS_GO
+=
$(d)
/preload.go
DEPS_GO
+=
$(d)
/preload.go
include
mk/footer.mk
include
mk/footer.mk
plugin/loader/preload.sh
View file @
58e52f35
...
@@ -4,6 +4,11 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
...
@@ -4,6 +4,11 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
to_preload
()
{
to_preload
()
{
awk
'NF'
"
$DIR
/preload_list"
|
sed
'/^#/d'
awk
'NF'
"
$DIR
/preload_list"
|
sed
'/^#/d'
if
[[
-n
"
$IPFS_PLUGINS
"
]]
;
then
for
plugin
in
$IPFS_PLUGINS
;
do
echo
"
$plugin
github.com/ipfs/go-ipfs/plugin/plugins/
$plugin
*"
done
fi
}
}
cat
<<
EOL
cat
<<
EOL
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment