Description
Easy trivial configuration for Redis.
Description
Datatype to parse redis connection settings from file like
host: localhost # host name or address
port: 6379 # you can specify either port
# socket: /run/redis.socket # or unix socket path
# service: redis # or service name
password: "pass" # if not specified then no password used
database: 0 # database number to connect to
max-connections: 5 # max connections in pool
max-idle-time: 30 # keep connection open for 30 seconds
timeout: 30 # connection timeout
README.md
How
Just copy this
host: localhost # host name or address
port: 6379 # you can specify either port
# socket: /run/redis.socket # or unix socket path
# service: redis # or service name
password: "pass" # if not specified then no password used
database: 0 # database number to connect to
max-connections: 5 # max connections in pool
max-idle-time: 30 # keep connection open for 30 seconds
timeout: 30 # connection timeout
to your config file, then
import Data.Yaml
import Database.Redis.Config
main :: IO ()
main = do
conn <- decodeFile "config/redis.yml" >>= \case
Nothing -> fail "Could not parse redis.conf"
Just conf -> connectRedis conf
run conn
Thats all, you already working with Redis connection.