Use tlsManagerSettings if connectIsSecure is True
Also provide convenient default instances for ConnectInfo for AWS and play (minio service).
This commit is contained in:
parent
b36fbb3a2f
commit
d17d6f216d
@ -2,6 +2,8 @@ module Network.Minio
|
|||||||
(
|
(
|
||||||
|
|
||||||
ConnectInfo(..)
|
ConnectInfo(..)
|
||||||
|
, aws
|
||||||
|
, play
|
||||||
, connect
|
, connect
|
||||||
|
|
||||||
, Minio
|
, Minio
|
||||||
|
|||||||
@ -28,6 +28,28 @@ data ConnectInfo = ConnectInfo {
|
|||||||
instance Default ConnectInfo where
|
instance Default ConnectInfo where
|
||||||
def = ConnectInfo "localhost" 9000 "minio" "minio123" False
|
def = ConnectInfo "localhost" 9000 "minio" "minio123" False
|
||||||
|
|
||||||
|
-- |
|
||||||
|
-- Default aws ConnectInfo. Credentials should be supplied before use.
|
||||||
|
aws :: ConnectInfo
|
||||||
|
aws = def {
|
||||||
|
connectHost = "s3.amazonaws.com"
|
||||||
|
, connectPort = 443
|
||||||
|
, connectAccessKey = ""
|
||||||
|
, connectSecretKey = ""
|
||||||
|
, connectIsSecure = True
|
||||||
|
}
|
||||||
|
|
||||||
|
-- |
|
||||||
|
-- Default minio play server ConnectInfo. Credentials are already filled.
|
||||||
|
play :: ConnectInfo
|
||||||
|
play = def {
|
||||||
|
connectHost = "play.minio.io"
|
||||||
|
, connectPort = 9000
|
||||||
|
, connectAccessKey = "Q3AM3UQ867SPQQA43P2F"
|
||||||
|
, connectSecretKey = "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG"
|
||||||
|
, connectIsSecure = True
|
||||||
|
}
|
||||||
|
|
||||||
-- |
|
-- |
|
||||||
-- Represents a bucket in the object store
|
-- Represents a bucket in the object store
|
||||||
type Bucket = Text
|
type Bucket = Text
|
||||||
@ -180,7 +202,9 @@ data MinioConn = MinioConn {
|
|||||||
-- be passed to 'runMinio'
|
-- be passed to 'runMinio'
|
||||||
connect :: ConnectInfo -> IO MinioConn
|
connect :: ConnectInfo -> IO MinioConn
|
||||||
connect ci = do
|
connect ci = do
|
||||||
mgr <- NC.newManager defaultManagerSettings
|
let settings = bool defaultManagerSettings NC.tlsManagerSettings $
|
||||||
|
connectIsSecure ci
|
||||||
|
mgr <- NC.newManager settings
|
||||||
return $ MinioConn ci mgr
|
return $ MinioConn ci mgr
|
||||||
|
|
||||||
-- | Run the Minio action and return the result or an error.
|
-- | Run the Minio action and return the result or an error.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user