try to load the config from the packr box (doesn't work)

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-24 11:32:26 -07:00
parent 6fba083fdd
commit 2b7db182f9
2 changed files with 18 additions and 2 deletions

View File

@ -122,6 +122,8 @@ func ReadReceivedData(data *pb.Event, mh *gui.TableData) {
mh.Rows[row].HumanData[5].Color = defaultTextBlack
mh.Rows[row].HumanData[6].Text = fmt.Sprintf("Details %s",item.Name)
mh.Rows[row].PbVM = item
log.Println("\titem=", item)
log.Println("\titem.Name=", item.Name)
log.Println("\tRows[row]=", mh.Rows[row])

18
main.go
View File

@ -68,11 +68,13 @@ func onExit(err error) {
os.Exit(0)
}
var packrBox packr.Box
func main() {
// This puts all the files in that directory in the binary
// This directory includes the default config file if there is not already one
box := packr.NewBox("./resources")
defaultConfig, _ := box.FindString("cloud.json")
packrBox = packr.NewBox("./resources")
defaultConfig, _ := packrBox.FindString("cloud.json")
// This will parse the command line and config file
parseConfig(defaultConfig)
@ -146,6 +148,18 @@ func buttonClick(b *gui.ButtonMap) {
if (b.Note == "QUIT") {
onExit(nil)
}
if (b.Note == "CONFIG") {
log.Println("TRY TO LOAD DEFAULT CONFIG")
defaultConfig, _ := packrBox.FindString("test.json")
config.LoadData(defaultConfig)
log.Println("defaultConfig =", defaultConfig)
for account, _ := range config.StringMap("accounts") {
log.Println("gui.State = splash BUT THERE IS AN ACCOUNT = ", account)
log.Println("gui.State = splash BUT THERE IS AN ACCOUNT = ", account)
log.Println("SETTING gui.State =", gui.Data.State)
}
gui.Data.State = "done"
}
if (b.Note == "DEBUG") {
log.Println("debug.PrintStack() (SHOULD BE JUST THIS goroutine)")
debug.PrintStack()