Skip to content

Commit

Permalink
Merge pull request #47 from juhp/master
Browse files Browse the repository at this point in the history
add CURATOR_AWS_OPTIONS
  • Loading branch information
juhp authored Dec 8, 2024
2 parents 54cc5a9 + b4975dc commit e5dbde5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 20 deletions.
4 changes: 2 additions & 2 deletions curator.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.35.2.
-- This file has been generated from package.yaml by hpack version 0.36.1.
--
-- see: https://github.com/sol/hpack

Expand Down Expand Up @@ -57,7 +57,7 @@ executable casa-curator
TypeOperators
ghc-options: -optP-Wno-nonportable-include-path -threaded
build-depends:
aeson
aeson <2.2
, base >=4.10 && <5
, bytestring
, casa-client
Expand Down
3 changes: 2 additions & 1 deletion package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ executables:
- text
- optparse-simple
- containers
- aeson
# aeson 2.2 needs attoparsec-aeson
- aeson < 2.2
- http-conduit
- syb
- persistent-sqlite
Expand Down
36 changes: 19 additions & 17 deletions src/Curator/UploadDocs.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import qualified RIO.ByteString.Lazy as BL
import RIO.Process
import RIO.FilePath ((</>))

import System.Environment.Blank (getEnvDefault)

import qualified Codec.Archive.Tar as Tar
import qualified Codec.Archive.Tar.Entry as Tar

Expand All @@ -42,26 +44,26 @@ uploadDocs input' name bucket = do
D.createDirectoryIfMissing True $ input </> "hoogle"
BL.writeFile (input </> "hoogle" </> "orig.tar") hooglesLBS

-- maybe default to --quiet or "--only-show-errors"?
curator_AWS_OPTS <- liftIO $ fmap words $
getEnvDefault "CURATOR_AWS_OPTIONS" ""
logInfo "Shelling out to AWS CLI to upload docs"
proc
"time" -- added for https://github.com/commercialhaskell/stackage-infrastructure/issues/4
(
"aws"
: -- added for https://github.com/commercialhaskell/stackage-infrastructure/issues/4
[
"s3"
, "cp"
-- -- commented out to debug https://github.com/commercialhaskell/stackage-infrastructure/issues/4
--, "--only-show-errors"
, "--recursive"
, "--acl"
, "public-read"
, "--cache-control"
, "maxage=31536000"
, input
, T.unpack $ "s3://" <> bucket <> "/" <> name <> "/"
]
) -- added for https://github.com/commercialhaskell/stackage-infrastructure/issues/4
( [ "aws"
, "s3"
, "cp"]
++
curator_AWS_OPTS
++
[ "--recursive"
, "--acl"
, "public-read"
, "--cache-control"
, "maxage=31536000"
, input
, T.unpack $ "s3://" <> bucket <> "/" <> name <> "/"
] )
runProcess_

-- | Create a TAR entry for each Hoogle txt file. Unfortunately doesn't stream.
Expand Down

0 comments on commit e5dbde5

Please sign in to comment.