X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=lib%2Fxdsconfig%2Fconfig.go;h=93c8f4b961ad29dedb9c67ffffc7722735a84f68;hb=247bb7c2db5f0d48178398599348249bf886ebbc;hp=1cc48c5d348f48aac317d2c5d9cde225c241e9ed;hpb=32791ffed5bdfaa698e90f9c067dc6e8ababbfc3;p=src%2Fxds%2Fxds-agent.git diff --git a/lib/xdsconfig/config.go b/lib/xdsconfig/config.go index 1cc48c5..93c8f4b 100644 --- a/lib/xdsconfig/config.go +++ b/lib/xdsconfig/config.go @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017-2018 "IoT.bzh" + * Author Sebastien Douheret + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package xdsconfig import ( @@ -7,8 +24,8 @@ import ( "os" + common "gerrit.automotivelinux.org/gerrit/src/xds/xds-common.git" "github.com/Sirupsen/logrus" - common "github.com/iotbzh/xds-common/golib" uuid "github.com/satori/go.uuid" "github.com/urfave/cli" ) @@ -74,6 +91,12 @@ func Init(ctx *cli.Context, log *logrus.Logger) (*Config, error) { SThgConf: &SyncThingConf{ Home: defaultSTHomeDir, }, + ProfileConf: ProfileConfT{ + XDSBinder: XDSBinderConf{ + URL: "http://localhost:8810", + ConnRetry: 10, + }, + }, }, Log: log, } @@ -89,11 +112,18 @@ func Init(ctx *cli.Context, log *logrus.Logger) (*Config, error) { // Handle where Logs are redirected: // default 'stdout' (logfile option default value) // else use file (or filepath) set by --logfile option - // that may be overwritten by LogsDir field of config file + // else use LogsDir field of config file logF := c.Options.LogFile logD := c.FileConf.LogsDir if logF != "stdout" { - if logD != "" { + if logF != "" { + if common.IsDir(logF) { + logD = logF + logF = filepath.Join(logF, "xds-agent.log") + } else { + logD = filepath.Dir(logF) + } + } else if logD != "" { lf := filepath.Base(logF) if lf == "" || lf == "." { lf = "xds-agent.log"