make var public
This commit is contained in:
parent
087549e2ba
commit
1f91bd8af0
|
@ -158,7 +158,7 @@ cscli api credentials # Display your API credentials
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = outputCTX.LoadAPIConfig(path.Join(config.installFolder, apiConfigFile))
|
err = outputCTX.LoadAPIConfig(path.Join(config.InstallFolder, apiConfigFile))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,7 @@ func restoreFromDirectory(source string) error {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
stage := file.Name()
|
stage := file.Name()
|
||||||
stagedir := fmt.Sprintf("%s/%s/%s/", config.installFolder, itype, stage)
|
stagedir := fmt.Sprintf("%s/%s/%s/", config.InstallFolder, itype, stage)
|
||||||
log.Debugf("Found stage %s in %s, target directory : %s", stage, itype, stagedir)
|
log.Debugf("Found stage %s in %s, target directory : %s", stage, itype, stagedir)
|
||||||
if err = os.MkdirAll(stagedir, os.ModePerm); err != nil {
|
if err = os.MkdirAll(stagedir, os.ModePerm); err != nil {
|
||||||
return fmt.Errorf("error while creating stage directory %s : %s", stagedir, err)
|
return fmt.Errorf("error while creating stage directory %s : %s", stagedir, err)
|
||||||
|
@ -188,7 +188,7 @@ func restoreFromDirectory(source string) error {
|
||||||
/*
|
/*
|
||||||
Restore acquis
|
Restore acquis
|
||||||
*/
|
*/
|
||||||
yamlAcquisFile := fmt.Sprintf("%s/acquis.yaml", config.installFolder)
|
yamlAcquisFile := fmt.Sprintf("%s/acquis.yaml", config.InstallFolder)
|
||||||
bac := fmt.Sprintf("%s/acquis.yaml", source)
|
bac := fmt.Sprintf("%s/acquis.yaml", source)
|
||||||
if err = copyFile(bac, yamlAcquisFile); err != nil {
|
if err = copyFile(bac, yamlAcquisFile); err != nil {
|
||||||
return fmt.Errorf("failed copy %s to %s : %s", bac, yamlAcquisFile, err)
|
return fmt.Errorf("failed copy %s to %s : %s", bac, yamlAcquisFile, err)
|
||||||
|
@ -202,7 +202,7 @@ func restoreAPICreds(source string) error {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
/*check existing configuration*/
|
/*check existing configuration*/
|
||||||
apiyaml := path.Join(config.installFolder, apiConfigFile)
|
apiyaml := path.Join(config.InstallFolder, apiConfigFile)
|
||||||
|
|
||||||
api := &cwapi.ApiCtx{}
|
api := &cwapi.ApiCtx{}
|
||||||
if err = api.LoadConfig(apiyaml); err != nil {
|
if err = api.LoadConfig(apiyaml); err != nil {
|
||||||
|
@ -332,7 +332,7 @@ func backupToDirectory(target string) error {
|
||||||
/*
|
/*
|
||||||
Backup acquis
|
Backup acquis
|
||||||
*/
|
*/
|
||||||
yamlAcquisFile := fmt.Sprintf("%s/acquis.yaml", config.installFolder)
|
yamlAcquisFile := fmt.Sprintf("%s/acquis.yaml", config.InstallFolder)
|
||||||
bac := fmt.Sprintf("%s/acquis.yaml", target)
|
bac := fmt.Sprintf("%s/acquis.yaml", target)
|
||||||
if err = copyFile(yamlAcquisFile, bac); err != nil {
|
if err = copyFile(yamlAcquisFile, bac); err != nil {
|
||||||
return fmt.Errorf("failed copy %s to %s : %s", yamlAcquisFile, bac, err)
|
return fmt.Errorf("failed copy %s to %s : %s", yamlAcquisFile, bac, err)
|
||||||
|
@ -341,7 +341,7 @@ func backupToDirectory(target string) error {
|
||||||
/*
|
/*
|
||||||
Backup default.yaml
|
Backup default.yaml
|
||||||
*/
|
*/
|
||||||
defyaml := fmt.Sprintf("%s/default.yaml", config.installFolder)
|
defyaml := fmt.Sprintf("%s/default.yaml", config.InstallFolder)
|
||||||
bac = fmt.Sprintf("%s/default.yaml", target)
|
bac = fmt.Sprintf("%s/default.yaml", target)
|
||||||
if err = copyFile(defyaml, bac); err != nil {
|
if err = copyFile(defyaml, bac); err != nil {
|
||||||
return fmt.Errorf("failed copy %s to %s : %s", yamlAcquisFile, bac, err)
|
return fmt.Errorf("failed copy %s to %s : %s", yamlAcquisFile, bac, err)
|
||||||
|
@ -354,8 +354,8 @@ func backupToDirectory(target string) error {
|
||||||
log.Fatalf("no API output context, won't save api credentials")
|
log.Fatalf("no API output context, won't save api credentials")
|
||||||
}
|
}
|
||||||
outputCTX.API = &cwapi.ApiCtx{}
|
outputCTX.API = &cwapi.ApiCtx{}
|
||||||
if err = outputCTX.API.LoadConfig(path.Join(config.installFolder, apiConfigFile)); err != nil {
|
if err = outputCTX.API.LoadConfig(path.Join(config.InstallFolder, apiConfigFile)); err != nil {
|
||||||
return fmt.Errorf("unable to load api config %s : %s", path.Join(config.installFolder, apiConfigFile), err)
|
return fmt.Errorf("unable to load api config %s : %s", path.Join(config.InstallFolder, apiConfigFile), err)
|
||||||
}
|
}
|
||||||
credsYaml, err := json.Marshal(&outputCTX.API.Creds)
|
credsYaml, err := json.Marshal(&outputCTX.API.Creds)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -15,7 +15,7 @@ type cliConfig struct {
|
||||||
configFolder string
|
configFolder string
|
||||||
output string
|
output string
|
||||||
HubFolder string `yaml:"hub_folder"`
|
HubFolder string `yaml:"hub_folder"`
|
||||||
installFolder string
|
InstallFolder string
|
||||||
BackendPluginFolder string `yaml:"backend_folder"`
|
BackendPluginFolder string `yaml:"backend_folder"`
|
||||||
DataFolder string `yaml:"data_folder"`
|
DataFolder string `yaml:"data_folder"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,12 +51,12 @@ func initConfig() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*read config*/
|
/*read config*/
|
||||||
config.installFolder = filepath.Join(filepath.Clean(csConfig.ConfigFolder))
|
config.InstallFolder = filepath.Join(filepath.Clean(csConfig.ConfigFolder))
|
||||||
config.HubFolder = filepath.Clean(config.configFolder + "/hub/")
|
config.HubFolder = filepath.Clean(config.configFolder + "/hub/")
|
||||||
config.BackendPluginFolder = filepath.Clean(csConfig.OutputConfig.BackendFolder)
|
config.BackendPluginFolder = filepath.Clean(csConfig.OutputConfig.BackendFolder)
|
||||||
config.DataFolder = filepath.Clean(csConfig.DataFolder)
|
config.DataFolder = filepath.Clean(csConfig.DataFolder)
|
||||||
//
|
//
|
||||||
cwhub.Installdir = config.installFolder
|
cwhub.Installdir = config.InstallFolder
|
||||||
cwhub.Cfgdir = config.configFolder
|
cwhub.Cfgdir = config.configFolder
|
||||||
cwhub.Hubdir = config.HubFolder
|
cwhub.Hubdir = config.HubFolder
|
||||||
config.configured = true
|
config.configured = true
|
||||||
|
|
|
@ -42,8 +42,8 @@ type ItemVersion struct {
|
||||||
//Item can be : parsed, scenario, collection
|
//Item can be : parsed, scenario, collection
|
||||||
type Item struct {
|
type Item struct {
|
||||||
/*descriptive info*/
|
/*descriptive info*/
|
||||||
Type string `yaml:"type,omitempty"` //parser|postoverflows|scenario|collection(|enrich)
|
Type string `yaml:"type,omitempty"` //parser|postoverflows|scenario|collection(|enrich)
|
||||||
Stage string `json:"stage" yaml:"type,omitempty,omitempty"` //Stage for parser|postoverflow : s00-raw/s01-...
|
Stage string `json:"stage" yaml:"stage,omitempty,omitempty"` //Stage for parser|postoverflow : s00-raw/s01-...
|
||||||
Name string //as seen in .config.json, usually "author/name"
|
Name string //as seen in .config.json, usually "author/name"
|
||||||
FileName string //the filename, ie. apache2-logs.yaml
|
FileName string //the filename, ie. apache2-logs.yaml
|
||||||
Description string `yaml:"description,omitempty"` //as seen in .config.json
|
Description string `yaml:"description,omitempty"` //as seen in .config.json
|
||||||
|
|
Loading…
Reference in a new issue