mirror of
https://github.com/henrygd/beszel.git
synced 2025-12-17 02:36:17 +01:00
refactor(dev): use ENV var to enable hub dev mode
This commit is contained in:
@@ -77,13 +77,12 @@ func GetEnv(key string) (value string, exists bool) {
|
||||
}
|
||||
|
||||
func (h *Hub) Run() {
|
||||
// loosely check if it was executed using "go run"
|
||||
isGoRun := strings.HasPrefix(os.Args[0], os.TempDir())
|
||||
isDev := os.Getenv("ENV") == "dev"
|
||||
|
||||
// enable auto creation of migration files when making collection changes in the Admin UI
|
||||
migratecmd.MustRegister(h, h.RootCmd, migratecmd.Config{
|
||||
// (the isGoRun check is to enable it only during development)
|
||||
Automigrate: isGoRun,
|
||||
// (the isDev check is to enable it only during development)
|
||||
Automigrate: isDev,
|
||||
Dir: "../../migrations",
|
||||
})
|
||||
|
||||
@@ -132,7 +131,7 @@ func (h *Hub) Run() {
|
||||
|
||||
// serve web ui
|
||||
h.OnServe().BindFunc(func(se *core.ServeEvent) error {
|
||||
switch isGoRun {
|
||||
switch isDev {
|
||||
case true:
|
||||
proxy := httputil.NewSingleHostReverseProxy(&url.URL{
|
||||
Scheme: "http",
|
||||
|
||||
Reference in New Issue
Block a user