stork-tool tries to access source files
Under some conditions, like running under some users, stork-tool tries to access source files which should never happen because they are not accessible in a production setup:
$ sudo -u postgres stork-tool db-create
panic: open /home/andrei/work/isc/stork/backend/server/database/migrations: permission denied
goroutine 1 [running]:
github.com/go-pg/migrations/v8.(*Collection).MustRegisterTx(...)
/home/andrei/work/isc/stork/tools/golang/gopath/pkg/mod/github.com/go-pg/migrations/v8@v8.1.0/collection.go:357
github.com/go-pg/migrations/v8.MustRegisterTx(...)
/home/andrei/work/isc/stork/tools/golang/gopath/pkg/mod/github.com/go-pg/migrations/v8@v8.1.0/default.go:35
isc.org/stork/server/database/migrations.init.0()
/home/andrei/work/isc/stork/backend/server/database/migrations/10_hard_delete.go:8 +0x65
This patch proposed by @marcin and @slawek makes the panic not occur anymore:
diff --git a/backend/server/database/migrations/00_init.go b/backend/server/database/migrations/00_init.go
new file mode 100644
index 00000000..8b845fb5
--- /dev/null
+++ b/backend/server/database/migrations/00_init.go
@@ -0,0 +1,9 @@
+package dbmigs
+
+import (
+ "github.com/go-pg/migrations/v8"
+)
+
+func init() {
+ migrations.DefaultCollection.DisableSQLAutodiscover(true)
+}