summaryrefslogtreecommitdiffstats
path: root/lib/xdsconfig
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-11-29 08:54:00 +0100
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-11-29 11:10:30 +0100
commit2f7828d01f4c4ca2909f95f098627cd5475ed225 (patch)
treeb5e71920b813b95cae3e32044be08b99223348ec /lib/xdsconfig
parent5caebfb4b7c3b73988f067082b219ce5b7f409ba (diff)
Refit source files to have a public xs-apiv1 lib package.
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'lib/xdsconfig')
-rw-r--r--lib/xdsconfig/builderconfig.go15
-rw-r--r--lib/xdsconfig/config.go23
2 files changed, 16 insertions, 22 deletions
diff --git a/lib/xdsconfig/builderconfig.go b/lib/xdsconfig/builderconfig.go
index 6fc1814..3b1ca55 100644
--- a/lib/xdsconfig/builderconfig.go
+++ b/lib/xdsconfig/builderconfig.go
@@ -3,24 +3,19 @@ package xdsconfig
import (
"errors"
"net"
-)
-// BuilderConfig represents the builder container configuration
-type BuilderConfig struct {
- IP string `json:"ip"`
- Port string `json:"port"`
- SyncThingID string `json:"syncThingID"`
-}
+ "github.com/iotbzh/xds-server/lib/xsapiv1"
+)
// NewBuilderConfig creates a new BuilderConfig instance
-func NewBuilderConfig(stID string) (BuilderConfig, error) {
+func NewBuilderConfig(stID string) (xsapiv1.BuilderConfig, error) {
// Do we really need it ? may be not accessible from client side
ip, err := getLocalIP()
if err != nil {
- return BuilderConfig{}, err
+ return xsapiv1.BuilderConfig{}, err
}
- b := BuilderConfig{
+ b := xsapiv1.BuilderConfig{
IP: ip, // TODO currently not used
Port: "", // TODO currently not used
SyncThingID: stID,
diff --git a/lib/xdsconfig/config.go b/lib/xdsconfig/config.go
index 0fc1346..0201d40 100644
--- a/lib/xdsconfig/config.go
+++ b/lib/xdsconfig/config.go
@@ -9,16 +9,13 @@ import (
"github.com/Sirupsen/logrus"
"github.com/codegangsta/cli"
common "github.com/iotbzh/xds-common/golib"
+ "github.com/iotbzh/xds-server/lib/xsapiv1"
)
// Config parameters (json format) of /config command
type Config struct {
- ServerUID string `json:"id"`
- Version string `json:"version"`
- APIVersion string `json:"apiVersion"`
- VersionGitTag string `json:"gitTag"`
- SupportedSharing map[string]bool `json:"supportedSharing"`
- Builder BuilderConfig `json:"builder"`
+ // Public APIConfig fields
+ xsapiv1.APIConfig
// Private (un-exported fields in REST GET /config route)
Options Options `json:"-"`
@@ -64,12 +61,14 @@ func Init(cliCtx *cli.Context, log *logrus.Logger) (*Config, error) {
// Define default configuration
c := Config{
- ServerUID: uuid,
- Version: cliCtx.App.Metadata["version"].(string),
- APIVersion: DefaultAPIVersion,
- VersionGitTag: cliCtx.App.Metadata["git-tag"].(string),
- Builder: BuilderConfig{},
- SupportedSharing: map[string]bool{ /*FIXME USE folder.TypePathMap*/ "PathMap": true},
+ APIConfig: xsapiv1.APIConfig{
+ ServerUID: uuid,
+ Version: cliCtx.App.Metadata["version"].(string),
+ APIVersion: DefaultAPIVersion,
+ VersionGitTag: cliCtx.App.Metadata["git-tag"].(string),
+ Builder: xsapiv1.BuilderConfig{},
+ SupportedSharing: map[string]bool{ /*FIXME USE folder.TypePathMap*/ "PathMap": true},
+ },
Options: Options{
ConfigFile: cliCtx.GlobalString("config"),