automuteus / galactus

The All-Powerful Socket.io Connection Aggregator
MIT License
22 stars 11 forks source link

[v7] Self-hosted instance does not activate the premium features. #13

Open kurokobo opened 3 years ago

kurokobo commented 3 years ago

Describe the bug

The premium features cannot be used when the instance is self-hosted.

To Reproduce

  1. docker-compose down -v
  2. docker-compose up -d
  3. .au s size (not limited for this, all premium features are affected)

Additional Information

AutoMuteUs was changed to use Galactus to check premium status for the guild by this commit, but the credentials for PSQL aren't passed to galactus by current docker-compose and initialization for PSQL interface is skipped, therefore GetGuildPremiumHandler returns nothing instead of self-hosted state (by faked response from utils). As a result, the instance is determined as free tier.

The bot returns the message Sorry, but that setting is reserved for AutoMuteUs Premium users! See .au premium for details and some logs about GetGuildPremiumHandler are recorded.

galactus_1    | {"level":"error","ts":1617433894.30779,"caller":"galactus/guild.go:367","msg":"storage interface has not been initialized","stacktrace":"github.com/automuteus/galactus/internal/galactus.(*GalactusAPI).GetGuildPremiumHandler.func1\n\t/src/internal/galactus/guild.go:367\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2042\ngithub.com/gorilla/mux.(*Router).ServeHTTP\n\t/go/pkg/mod/github.com/gorilla/mux@v1.8.0/mux.go:210\nnet/http.serverHandler.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2843\nnet/http.(*conn).serve\n\t/usr/local/go/src/net/http/server.go:1925"}

Workaround

The easiest workaround is adding POSTGRES_ADDR, POSTGRES_USER, and POSTGRES_PASS to ENV for galactus, however, it may be a bit excessive to pass DB credentials that will never be used just to get a fake response...

Version of bot & capture