bee icon indicating copy to clipboard operation
bee copied to clipboard

bee bale not functioning properly...

Open james-powis opened this issue 5 years ago • 1 comments

The command runs just fine:

KAPAMACX3DHHTD6:api p2786887$ bee bale
______
| ___ \
| |_/ /  ___   ___
| ___ \ / _ \ / _ \
| |_/ /|  __/|  __/
\____/  \___| \___| v1.10.0
2018/08/08 15:15:26 INFO     ▶ 0001 Packaging directory: swagger
2018/08/08 15:15:30 INFO     ▶ 0002 Packaging directory: conf
2018/08/08 15:15:30 SUCCESS  ▶ 0003 Baled resources successfully!
KAPAMACX3DHHTD6:api p2786887$

however looking at bale.go we see the problem:

package main
  
import(
  "os"
  "strings"
  "path"

  ""
)

func isExist(path string) bool {
  _, err := os.Stat(path)
  return err == nil || os.IsExist(err)
}
...

The "" in the imports in not proper...

james-powis avatar Aug 08 '18 21:08 james-powis

OK so figured it out by using beego/beeweb as a model... bee.json must be as follows:

  "bale": {
    "dirs": ["swagger", "conf"],
    "import": "my/app/bale"
  }
}

But in "There be dragons" fashion, the bale unpack is a HUGE race condition... while perfectly usable for static assets such as html, css, and js... It absolutely should not be used for config files... should the config be picked up prior to the bale unpacking the config everything would default, where the config file says the env name is dev, the result is prod configuration.

Because of this significant risk and race condition I am going to leave this issue open in hopes that somewhere someone closer to beego guts than I am has some means of setting up a:

If bale is in use; then promise(unbale).then(read config and continue loading) fashion

james-powis avatar Aug 08 '18 21:08 james-powis