Sebastien Desemberg
Sebastien Desemberg

Reputation: 85

SailsJS Redis connection string on Azure

I'm trying to connect Azure Cache for Redis in my SailJS project but get an error called "A hook (userconfig) failed to load!" Locally I use this string which works > redis_url: 'redis://127.0.0.1:6379'

Azure supplies a Primary Key, let us call it xyz and a Primary Connection string imageAware.redis.cache.windows.net:6380,password=xyz,ssl=True,abortConnect=False

I have tried the following string in my config file but that is when I get the above error. redis_url: 'redis://:[email protected]:6379/0'

Which is the correct format for the Azure Cache for Redis connection string?

Upvotes: 0

Views: 150

Answers (1)

Sebastien Desemberg
Sebastien Desemberg

Reputation: 85

I resolved the issue by adding the following to my production.js file.

    session: {
        adapter: '@sailshq/connect-redis',
        url: 'redis://:[email protected]:6379/0',
        cookie: {
            maxAge: 24 * 60 * 60 * 1000,
            secure: false
        }
    },

Upvotes: 0

Related Questions