diff --git a/railway.toml b/railway.toml new file mode 100644 index 0000000..7a2f354 --- /dev/null +++ b/railway.toml @@ -0,0 +1,9 @@ +[build] +builder = "dockerfile" +dockerfilePath = "Dockerfile" + +[deploy] +healthcheckPath = "/dynamic.js.php" +healthcheckTimeout = 30 +restartPolicyType = "on_failure" +restartPolicyMaxRetries = 3 diff --git a/store/redis.go b/store/redis.go index 7bb47aa..9749d3e 100644 --- a/store/redis.go +++ b/store/redis.go @@ -24,15 +24,23 @@ type Redis struct { func NewRedis(addr, password, prefix string) (*Redis, error) { var opts *redis.Options + var err error - // unix socket detection - if strings.HasPrefix(addr, "/") { + // redis:// URL detection + if strings.HasPrefix(addr, "redis://") || strings.HasPrefix(addr, "rediss://") { + opts, err = redis.ParseURL(addr) + if err != nil { + return nil, err + } + } else if strings.HasPrefix(addr, "/") { + // unix socket opts = &redis.Options{ Network: "unix", Addr: addr, Password: password, } } else { + // host:port opts = &redis.Options{ Addr: addr, Password: password,