You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Transforms allow you to use Go plugins to modify a project that is sent as part of an update. Go plugins are Linux only and have been available since v1.8.
16
+
17
+
### Confguration
18
+
The api-server will load all plugins from a directory that is set via the `TRANSFORM_DIR` environment variable. Example:
19
+
```
20
+
$ export TRANSFORM_DIR=plugins
21
+
$ ls plugins
22
+
iis.so foo.so bar.so
23
+
$ ./api-server
24
+
2017/03/03 12:56:05 Loading transform iis.so
25
+
2017/03/03 12:56:05 Loading transform foo.so
26
+
2017/03/03 12:56:05 Loading transform bar.so
27
+
````
28
+
29
+
### Writing Transforms
30
+
Writing transform involves implmenting a single function, `Update(p *lair.Project`. Here is a stub.
31
+
```
32
+
package main
33
+
34
+
import (
35
+
lair "github.com/lair-framework/go-lair"
36
+
)
37
+
38
+
func Update(p *lair.Project) {
39
+
for i := range p.Hosts {
40
+
p[i].Host.OS = "Trash"
41
+
}
42
+
}
43
+
```
44
+
45
+
This can now be built by running `go build -buildmode=plugin`.
0 commit comments