Skip to content

Commit

Permalink
Merge pull request #267 from SupercedeTech/prepare-2.0
Browse files Browse the repository at this point in the history
Prepare 2.0
  • Loading branch information
jappeace authored May 11, 2022
2 parents b7262bf + 951165c commit 4acb7f6
Show file tree
Hide file tree
Showing 17 changed files with 264 additions and 233 deletions.
7 changes: 7 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
+ Removed 'default' package.
+ All "Data" modules are now "Keter" modules.
+ Testing library switched from "hspec" to "tasty".
* Move Network.Http.ReverseProxy.Rewrite into Keter.Rewrite
* Move Codec.Archive.TempTarball into Keter.TempTarball
* Hide Keter.Aeson.KeyHelper
* Stop re-exporting common and rewrite from types
* Common no longer re-exports half of Haskell
* Rename Types to Config
* Move Common out of Config into root

## 1.9

Expand Down
17 changes: 9 additions & 8 deletions keter.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ Library
cpp-options: -DSYSTEM_FILEPATH

Exposed-Modules: Keter.Plugin.Postgres
Keter.Types
Keter.Types.V04
Keter.Types.V10
Keter.Types.Common
Keter.Types.Middleware
Keter.Config
Keter.Config.V04
Keter.Config.V10
Keter.Common
Keter.Config.Middleware
Keter.App
Keter.AppManager
Keter.LabelMap
Expand All @@ -99,12 +99,13 @@ Library
Keter.PortPool
Keter.Proxy
Keter.HostManager
Network.HTTP.ReverseProxy.Rewrite
Keter.Rewrite
Keter.Yaml.FilePath
Keter.Aeson.KeyHelper
Codec.Archive.TempTarball
Keter.TempTarball
Keter.Conduit.LogFile
Keter.Conduit.Process.Unix
Other-Modules:
Keter.Aeson.KeyHelper
ghc-options: -Wall
c-sources: cbits/process-tracker.c
hs-source-dirs: src
Expand Down
11 changes: 8 additions & 3 deletions src/Keter/App.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ module Keter.App
, showApp
) where

import Codec.Archive.TempTarball
import Keter.Common
import Data.Set (Set)
import Data.Text (Text)
import System.FilePath (FilePath)
import Data.Map (Map)
import Keter.Rewrite (ReverseProxyConfig (..))
import Keter.TempTarball
import Control.Applicative ((<$>), (<*>))
import Control.Arrow ((***))
import Control.Concurrent (forkIO, threadDelay)
Expand Down Expand Up @@ -46,7 +52,7 @@ import System.Directory (canonicalizePath, doesFileExist,
removeDirectoryRecursive)
import Keter.HostManager hiding (start)
import Keter.PortPool (PortPool, getPort, releasePort)
import Keter.Types
import Keter.Config
import Network.Socket
import Prelude hiding (FilePath)
import System.Environment (getEnvironment)
Expand All @@ -55,7 +61,6 @@ import System.Posix.Files (fileAccess)
import System.Posix.Types (EpochTime, GroupID, UserID)
import System.Timeout (timeout)
import qualified Network.TLS as TLS
import qualified Data.Text.Encoding as Text

data App = App
{ appModTime :: !(TVar (Maybe EpochTime))
Expand Down
8 changes: 7 additions & 1 deletion src/Keter/AppManager.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ module Keter.AppManager
, renderApps
) where

import Keter.Common
import Data.Set (Set)
import Data.Text (Text)
import System.FilePath (FilePath)
import Data.Map (Map)
import Control.Exception (SomeException)
import Control.Applicative
import Control.Concurrent (forkIO)
import Control.Concurrent.MVar (MVar, newMVar, withMVar)
Expand All @@ -33,7 +39,7 @@ import qualified Data.Text.Lazy.Builder as Builder
import Data.Traversable.WithIndex (itraverse)
import Keter.App (App, AppStartConfig, showApp)
import qualified Keter.App as App
import Keter.Types
import Keter.Config
import Prelude hiding (FilePath, log)
import System.Posix.Files (getFileStatus, modificationTime)
import System.Posix.Types (EpochTime)
Expand Down
2 changes: 1 addition & 1 deletion src/Keter/Cli.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Keter.Cli
, CliStates(..)
) where

import Keter.Types.Common
import Keter.Common
import Keter.AppManager
import Control.Concurrent (forkFinally)
import qualified Control.Exception as E
Expand Down
12 changes: 2 additions & 10 deletions src/Keter/Types/Common.hs → src/Keter/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,8 @@
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}

module Keter.Types.Common
( module Keter.Types.Common
, FilePath
, Text
, ByteString
, Set
, Map
, Exception
, SomeException
) where
-- | Provides logging, versioning and some type aliases
module Keter.Common where

import qualified Network.Wai as Wai
import Control.Exception (Exception, SomeException)
Expand Down
10 changes: 5 additions & 5 deletions src/Keter/Types.hs → src/Keter/Config.hs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
module Keter.Types
-- | This does a merger of V04 and V10
-- Effectivelly this provides the 'latest' config.
module Keter.Config
( module X
) where

import Keter.Types.Common as X
import Keter.Types.V04 as X (PortSettings (..), TLSConfig (..))
import Keter.Types.V10 as X
import Keter.Config.V04 as X (PortSettings (..), TLSConfig (..))
import Keter.Config.V10 as X
( BundleConfig (..)
, WebAppConfig (..)
, RedirectConfig (..)
Expand All @@ -23,4 +24,3 @@ import Keter.Types.V10 as X
, RestartCount (..)
, RequiresSecure
)
import Network.HTTP.ReverseProxy.Rewrite as X (ReverseProxyConfig (..), RewriteRule (..))
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{-# LANGUAGE OverloadedStrings, DeriveGeneric #-}

module Keter.Types.Middleware where
module Keter.Config.Middleware where

import Data.Aeson
import GHC.Generics
Expand Down
11 changes: 7 additions & 4 deletions src/Keter/Types/V04.hs → src/Keter/Config/V04.hs
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
{-# LANGUAGE OverloadedStrings #-}
-- | Legacy types from Keter version 0.4. Retained to keep backwards
-- compatibility in config file format.
module Keter.Types.V04 where
module Keter.Config.V04 where

import Control.Applicative
import Data.Aeson
import Data.Bool
import Data.Conduit.Network (HostPreference)
import qualified Data.Set as Set
import Data.String (fromString)
import Keter.Yaml.FilePath
import qualified System.FilePath as F
import Keter.Types.Common
import Network.HTTP.ReverseProxy.Rewrite
import Keter.Common
import Keter.Rewrite(ReverseProxyConfig)
import Data.Text (Text)
import System.FilePath (FilePath)
import Data.Set (Set)
import qualified Data.Set as Set
import qualified Network.Wai.Handler.Warp as Warp
import qualified Network.Wai.Handler.WarpTLS as WarpTLS
import qualified Network.TLS.SessionManager as TLSSession
Expand Down
14 changes: 9 additions & 5 deletions src/Keter/Types/V10.hs → src/Keter/Config/V10.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
module Keter.Types.V10 where
module Keter.Config.V10 where

import Control.Applicative ((<$>), (<*>), (<|>))
import Data.Aeson (FromJSON (..), ToJSON (..), Object,
Expand All @@ -22,13 +22,17 @@ import qualified Data.Vector as V
import Data.Word (Word)
import Keter.Yaml.FilePath
import qualified System.FilePath as F
import Keter.Types.Common
import Keter.Types.Middleware
import qualified Keter.Types.V04 as V04
import Network.HTTP.ReverseProxy.Rewrite (ReverseProxyConfig)
import Keter.Common
import Keter.Config.Middleware
import qualified Keter.Config.V04 as V04
import qualified Network.Wai.Handler.Warp as Warp
import qualified Network.Wai.Handler.WarpTLS as WarpTLS
import System.Posix.Types (EpochTime)
import Keter.Rewrite(ReverseProxyConfig)
import Data.Text (Text)
import System.FilePath (FilePath)
import Data.Set (Set)
import Data.Map (Map)

data BundleConfig = BundleConfig
{ bconfigStanzas :: !(Vector (Stanza ()))
Expand Down
Loading

0 comments on commit 4acb7f6

Please sign in to comment.