Plug-in mechanism
Required
- Go version 1.8(+)
- Compile service-center with GO_EXTLINK_ENABLED=1 and CGO_ENABLED=1
- The plugin file name must has suffix ‘_plugin.so’
- All plugin interface files are in infra package
Plug-in names
- auth: Customize authentication of service-center.
- uuid: Customize micro-service/instance id format.
- auditlog: Customize audit log for any change done to the service-center.
- cipher: Customize encryption and decryption of TLS certificate private key password.
- quota: Customize quota for instance registry.
- tracing: Customize tracing data reporter.
- tls: Customize loading the tls certificates in server
Example: an authentication plug-in
Step 1: code auth.go
auth.go is the implement from auth interface
package main
import (
"fmt"
"net/http"
)
func Identify(*http.Request) error {
// do something
return nil
}
Step 2: compile auth.go
GOPATH=$(pwd) go build -o auth_plugin.so -buildmode=plugin auth.go
Step 3: move the plug-in in plugins directory
mkdir ${service-center}/plugins
mv auth_plugin.so ${service-center}/plugins
Step 4: run service-center
cd ${service-center}
./servicecenter