-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Web application deployment manager, focusing on Haskell web frameworks -- -- Hackage documentation generation is not reliable. For up to date -- documentation, please see: -- http://www.stackage.org/package/keter. @package keter @version 1.7 -- | Handles allocation of temporary directories and unpacking of bundles -- into them. Sets owner and group of all created files and directories -- as necessary. module Codec.Archive.TempTarball data TempFolder setup :: FilePath -> IO TempFolder unpackTempTar :: Maybe (UserID, GroupID) -> TempFolder -> FilePath -> Text -> (FilePath -> IO a) -> IO a -- | Utilities for dealing with Aeson version update module Data.Aeson.KeyHelper -- | O(n*log n) Construct a map with the supplied mappings. If the -- list contains duplicate mappings, the later mappings take precedence. fromList :: (Eq k, Hashable k) => [(k, v)] -> HashMap k v -- | A map from keys to values. A map cannot contain duplicate keys; each -- key can map to at most one value. data HashMap k v -- | O(n) Produce a HashSet of all the keys in the given -- HashMap. -- --
--   >>> HashSet.keysSet (HashMap.fromList [(1, "a"), (2, "b")]
--   fromList [1,2]
--   
keysSet :: HashMap k a -> HashSet k -- | O(n*log n) Construct a map from a list of elements. Uses the -- provided function to merge duplicate entries. -- --

Examples

-- -- Given a list of key-value pairs where the keys are of different -- flavours, e.g: -- --
--   data Key = Div | Sub
--   
-- -- and the values need to be combined differently when there are -- duplicates, depending on the key: -- --
--   combine Div = div
--   combine Sub = (-)
--   
-- -- then fromListWithKey can be used as follows: -- --
--   fromListWithKey combine [(Div, 2), (Div, 6), (Sub, 2), (Sub, 3)]
--   = fromList [(Div, 3), (Sub, 1)]
--   
-- -- More generally, duplicate entries are accumulated as follows; -- --
--   fromListWith f [(k, a), (k, b), (k, c), (k, d)]
--   = fromList [(k, f k d (f k c (f k b a)))]
--   
fromListWithKey :: (Eq k, Hashable k) => (k -> v -> v -> v) -> [(k, v)] -> HashMap k v -- | O(n*log n) Construct a map from a list of elements. Uses the -- provided function f to merge duplicate entries with (f -- newVal oldVal). -- --

Examples

-- -- Given a list xs, create a map with the number of occurrences -- of each element in xs: -- --
--   let xs = ['a', 'b', 'a']
--   in fromListWith (+) [ (x, 1) | x <- xs ]
--   
--   = fromList [('a', 2), ('b', 1)]
--   
-- -- Given a list of key-value pairs xs :: [(k, v)], group all -- values by their keys and return a HashMap k [v]. -- --
--   let xs = ('a', 1), ('b', 2), ('a', 3)]
--   in fromListWith (++) [ (k, [v]) | (k, v) <- xs ]
--   
--   = fromList [('a', [3, 1]), ('b', [2])]
--   
-- -- Note that the lists in the resulting map contain elements in reverse -- order from their occurences in the original list. -- -- More generally, duplicate entries are accumulated as follows; this -- matters when f is not commutative or not associative. -- --
--   fromListWith f [(k, a), (k, b), (k, c), (k, d)]
--   = fromList [(k, f d (f c (f b a)))]
--   
fromListWith :: (Eq k, Hashable k) => (v -> v -> v) -> [(k, v)] -> HashMap k v -- | O(n+m) Intersection of two maps. If a key occurs in both maps -- the provided function is used to combine the values from the two maps. intersectionWithKey :: (Eq k, Hashable k) => (k -> v1 -> v2 -> v3) -> HashMap k v1 -> HashMap k v2 -> HashMap k v3 -- | O(n+m) Intersection of two maps. If a key occurs in both maps -- the provided function is used to combine the values from the two maps. intersectionWith :: (Eq k, Hashable k) => (v1 -> v2 -> v3) -> HashMap k v1 -> HashMap k v2 -> HashMap k v3 -- | O(n*log m) Difference with a combining function. When two equal -- keys are encountered, the combining function is applied to the values -- of these keys. If it returns Nothing, the element is discarded -- (proper set difference). If it returns (Just y), the -- element is updated with a new value y. differenceWith :: (Eq k, Hashable k) => (v -> w -> Maybe v) -> HashMap k v -> HashMap k w -> HashMap k v -- | O(n) Perform an Applicative action for each key-value -- pair in a HashMap and produce a HashMap of all the -- results. Each HashMap will be strict in all its values. -- --
--   traverseWithKey f = fmap (map id) . Data.HashMap.Lazy.traverseWithKey f
--   
-- -- Note: the order in which the actions occur is unspecified. In -- particular, when the map contains hash collisions, the order in which -- the actions associated with the keys involved will depend in an -- unspecified way on their insertion order. traverseWithKey :: Applicative f => (k -> v1 -> f v2) -> HashMap k v1 -> f (HashMap k v2) -- | O(n) Transform this map by applying a function to every value -- and retaining only some of them. mapMaybe :: (v1 -> Maybe v2) -> HashMap k v1 -> HashMap k v2 -- | O(n) Transform this map by applying a function to every value -- and retaining only some of them. mapMaybeWithKey :: (k -> v1 -> Maybe v2) -> HashMap k v1 -> HashMap k v2 -- | O(n) Transform this map by applying a function to every value. mapWithKey :: (k -> v1 -> v2) -> HashMap k v1 -> HashMap k v2 -- | O(n+m) The union of two maps. If a key occurs in both maps, the -- provided function (first argument) will be used to compute the result. unionWithKey :: (Eq k, Hashable k) => (k -> v -> v -> v) -> HashMap k v -> HashMap k v -> HashMap k v -- | O(n+m) The union of two maps. If a key occurs in both maps, the -- provided function (first argument) will be used to compute the result. unionWith :: (Eq k, Hashable k) => (v -> v -> v) -> HashMap k v -> HashMap k v -> HashMap k v -- | O(log n) The expression (alterF f k map) alters -- the value x at k, or absence thereof. -- -- alterF can be used to insert, delete, or update a value in a -- map. -- -- Note: alterF is a flipped version of the at combinator -- from Control.Lens.At. alterF :: (Functor f, Eq k, Hashable k) => (Maybe v -> f (Maybe v)) -> k -> HashMap k v -> f (HashMap k v) -- | O(log n) The expression (alter f k map) alters -- the value x at k, or absence thereof. -- -- alter can be used to insert, delete, or update a value in a -- map. In short: -- --
--   lookup k (alter f k m) = f (lookup k m)
--   
alter :: (Eq k, Hashable k) => (Maybe v -> Maybe v) -> k -> HashMap k v -> HashMap k v -- | O(log n) The expression (update f k map) -- updates the value x at k (if it is in the map). If -- (f x) is Nothing, the element is deleted. If it is -- (Just y), the key k is bound to the new value -- y. update :: (Eq k, Hashable k) => (a -> Maybe a) -> k -> HashMap k a -> HashMap k a -- | O(log n) Adjust the value tied to a given key in this map only -- if it is present. Otherwise, leave the map alone. adjust :: (Eq k, Hashable k) => (v -> v) -> k -> HashMap k v -> HashMap k v -- | O(log n) Associate the value with the key in this map. If this -- map previously contained a mapping for the key, the old value is -- replaced by the result of applying the given function to the new and -- old value. Example: -- --
--   insertWith f k v map
--     where f new old = new + old
--   
insertWith :: (Eq k, Hashable k) => (v -> v -> v) -> k -> v -> HashMap k v -> HashMap k v -- | O(log n) Associate the specified value with the specified key -- in this map. If this map previously contained a mapping for the key, -- the old value is replaced. insert :: (Eq k, Hashable k) => k -> v -> HashMap k v -> HashMap k v -- | O(1) Construct a map with a single element. singleton :: Hashable k => k -> v -> HashMap k v -- | O(n) Return a list of this map's elements. The list is produced -- lazily. The order of its elements is unspecified. toList :: HashMap k v -> [(k, v)] -- | O(n) Return a list of this map's values. The list is produced -- lazily. elems :: HashMap k v -> [v] -- | O(n) Return a list of this map's keys. The list is produced -- lazily. keys :: HashMap k v -> [k] -- | O(n) Filter this map by retaining only elements which values -- satisfy a predicate. filter :: (v -> Bool) -> HashMap k v -> HashMap k v -- | O(n) Filter this map by retaining only elements satisfying a -- predicate. filterWithKey :: (k -> v -> Bool) -> HashMap k v -> HashMap k v -- | O(n) Reduce the map by applying a function to each element and -- combining the results with a monoid operation. foldMapWithKey :: Monoid m => (k -> v -> m) -> HashMap k v -> m -- | O(n) Reduce this map by applying a binary operator to all -- elements, using the given starting value (typically the left-identity -- of the operator). foldlWithKey :: (a -> k -> v -> a) -> a -> HashMap k v -> a -- | O(n) Reduce this map by applying a binary operator to all -- elements, using the given starting value (typically the right-identity -- of the operator). foldrWithKey :: (k -> v -> a -> a) -> a -> HashMap k v -> a -- | O(n) Reduce this map by applying a binary operator to all -- elements, using the given starting value (typically the left-identity -- of the operator). foldl :: (a -> v -> a) -> a -> HashMap k v -> a -- | O(n) Reduce this map by applying a binary operator to all -- elements, using the given starting value (typically the right-identity -- of the operator). foldr :: (v -> a -> a) -> a -> HashMap k v -> a -- | O(n) Reduce this map by applying a binary operator to all -- elements, using the given starting value (typically the right-identity -- of the operator). Each application of the operator is evaluated before -- using the result in the next application. This function is strict in -- the starting value. foldrWithKey' :: (k -> v -> a -> a) -> a -> HashMap k v -> a -- | O(n) Reduce this map by applying a binary operator to all -- elements, using the given starting value (typically the left-identity -- of the operator). Each application of the operator is evaluated before -- using the result in the next application. This function is strict in -- the starting value. foldlWithKey' :: (a -> k -> v -> a) -> a -> HashMap k v -> a -- | O(n) Reduce this map by applying a binary operator to all -- elements, using the given starting value (typically the right-identity -- of the operator). Each application of the operator is evaluated before -- using the result in the next application. This function is strict in -- the starting value. foldr' :: (v -> a -> a) -> a -> HashMap k v -> a -- | O(n) Reduce this map by applying a binary operator to all -- elements, using the given starting value (typically the left-identity -- of the operator). Each application of the operator is evaluated before -- using the result in the next application. This function is strict in -- the starting value. foldl' :: (a -> v -> a) -> a -> HashMap k v -> a -- | O(n*log m) Intersection of two maps. Return elements of the -- first map for keys existing in the second. intersection :: (Eq k, Hashable k) => HashMap k v -> HashMap k w -> HashMap k v -- | O(n*log m) Difference of two maps. Return elements of the first -- map not existing in the second. difference :: (Eq k, Hashable k) => HashMap k v -> HashMap k w -> HashMap k v -- | Relate the keys of one map to the values of the other, by using the -- values of the former as keys for lookups in the latter. -- -- Complexity: <math>, where <math> is the size of the first -- argument -- --
--   >>> compose (fromList [('a', "A"), ('b', "B")]) (fromList [(1,'a'),(2,'b'),(3,'z')])
--   fromList [(1,"A"),(2,"B")]
--   
-- --
--   (compose bc ab !?) = (bc !?) <=< (ab !?)
--   
-- -- @since UNRELEASED compose :: (Eq b, Hashable b) => HashMap b c -> HashMap a b -> HashMap a c -- | Construct a set containing all elements from a list of sets. unions :: (Eq k, Hashable k) => [HashMap k v] -> HashMap k v -- | O(n+m) The union of two maps. If a key occurs in both maps, the -- mapping from the first will be the mapping in the result. -- --

Examples

-- --
--   >>> union (fromList [(1,'a'),(2,'b')]) (fromList [(2,'c'),(3,'d')])
--   fromList [(1,'a'),(2,'b'),(3,'d')]
--   
union :: (Eq k, Hashable k) => HashMap k v -> HashMap k v -> HashMap k v -- | O(n*log m) Inclusion of maps with value comparison. A map is -- included in another map if the keys are subsets and if the comparison -- function is true for the corresponding values: -- --
--   isSubmapOfBy cmpV m1 m2 = keys m1 `isSubsetOf` keys m2 &&
--                             and [ v1 `cmpV` v2 | (k1,v1) <- toList m1; let v2 = m2 ! k1 ]
--   
-- --

Examples

-- --
--   >>> isSubmapOfBy (<=) (fromList [(1,'a')]) (fromList [(1,'b'),(2,'c')])
--   True
--   
-- --
--   >>> isSubmapOfBy (<=) (fromList [(1,'b')]) (fromList [(1,'a'),(2,'c')])
--   False
--   
isSubmapOfBy :: (Eq k, Hashable k) => (v1 -> v2 -> Bool) -> HashMap k v1 -> HashMap k v2 -> Bool -- | O(n*log m) Inclusion of maps. A map is included in another map -- if the keys are subsets and the corresponding values are equal: -- --
--   isSubmapOf m1 m2 = keys m1 `isSubsetOf` keys m2 &&
--                      and [ v1 == v2 | (k1,v1) <- toList m1; let v2 = m2 ! k1 ]
--   
-- --

Examples

-- --
--   >>> fromList [(1,'a')] `isSubmapOf` fromList [(1,'a'),(2,'b')]
--   True
--   
-- --
--   >>> fromList [(1,'a'),(2,'b')] `isSubmapOf` fromList [(1,'a')]
--   False
--   
isSubmapOf :: (Eq k, Hashable k, Eq v) => HashMap k v -> HashMap k v -> Bool -- | O(log n) Remove the mapping for the specified key from this map -- if present. delete :: (Eq k, Hashable k) => k -> HashMap k v -> HashMap k v -- | O(log n) Return the value to which the specified key is mapped. -- Calls error if this map contains no mapping for the key. (!) :: (Eq k, Hashable k, HasCallStack) => HashMap k v -> k -> v infixl 9 ! -- | O(log n) Return the value to which the specified key is mapped, -- or the default value if this map contains no mapping for the key. -- -- DEPRECATED: lookupDefault is deprecated as of version 0.2.11, replaced -- by findWithDefault. lookupDefault :: (Eq k, Hashable k) => v -> k -> HashMap k v -> v -- | O(log n) Return the value to which the specified key is mapped, -- or the default value if this map contains no mapping for the key. findWithDefault :: (Eq k, Hashable k) => v -> k -> HashMap k v -> v -- | O(log n) Return the value to which the specified key is mapped, -- or Nothing if this map contains no mapping for the key. -- -- This is a flipped version of lookup. (!?) :: (Eq k, Hashable k) => HashMap k v -> k -> Maybe v -- | O(log n) Return the value to which the specified key is mapped, -- or Nothing if this map contains no mapping for the key. lookup :: (Eq k, Hashable k) => k -> HashMap k v -> Maybe v -- | O(log n) Return True if the specified key is present in -- the map, False otherwise. member :: (Eq k, Hashable k) => k -> HashMap k a -> Bool -- | O(n) Return the number of key-value mappings in this map. size :: HashMap k v -> Int -- | O(1) Return True if this map is empty, False -- otherwise. null :: HashMap k v -> Bool -- | O(1) Construct an empty map. empty :: HashMap k v toKey :: Text -> Text toText :: Text -> Text module Data.Conduit.LogFile -- | Represents a folder used for totating log files. -- -- Since 0.2.1 data RotatingLog -- | Create a new RotatingLog. -- -- Since 0.2.1 openRotatingLog :: FilePath -> Word -> IO RotatingLog addChunk :: RotatingLog -> ByteString -> IO () close :: RotatingLog -> IO () defaultMaxTotal :: Word -- | A RotatingLog which performs no logging. -- -- Since 0.2.1 dummy :: RotatingLog module Data.Conduit.Process.Unix -- | Represents the child process which handles process cleanup. -- -- Since 0.2.1 data ProcessTracker -- | Fork off the child cleanup process. -- -- This will ideally only be run once for your entire application. -- -- Since 0.2.1 initProcessTracker :: IO ProcessTracker -- | Abstract type containing information on a process which will be -- restarted. data MonitoredProcess -- | Run the given command, restarting if the process dies. monitorProcess :: (ByteString -> IO ()) -> ProcessTracker -> Maybe ByteString -> ByteString -> ByteString -> [ByteString] -> [(ByteString, ByteString)] -> (ByteString -> IO ()) -> (ExitCode -> IO Bool) -> IO MonitoredProcess -- | Terminate the process and prevent it from being restarted. terminateMonitoredProcess :: MonitoredProcess -> IO () printStatus :: MonitoredProcess -> IO Text instance GHC.Show.Show Data.Conduit.Process.Unix.ProcessTrackerException instance GHC.Exception.Type.Exception Data.Conduit.Process.Unix.ProcessTrackerException -- | Utilities for dealing with YAML config files which contain relative -- file paths. module Data.Yaml.FilePath -- | Parse a config file, using the ParseYamlFile typeclass. decodeFileRelative :: ParseYamlFile a => FilePath -> IO (Either ParseException a) -- | A replacement for the .: operator which will both parse a -- file path and apply the relative file logic. lookupBase :: ParseYamlFile a => BaseDir -> Object -> Text -> Parser a -- | A replacement for the .:? operator which will both parse a -- file path and apply the relative file logic. lookupBaseMaybe :: ParseYamlFile a => BaseDir -> Object -> Text -> Parser (Maybe a) -- | The directory from which we're reading the config file. data BaseDir -- | A replacement for the standard FromJSON typeclass which can -- handle relative filepaths. class ParseYamlFile a parseYamlFile :: ParseYamlFile a => BaseDir -> Value -> Parser a data NonEmptyVector a NonEmptyVector :: !a -> !Vector a -> NonEmptyVector a instance Data.Yaml.FilePath.ParseYamlFile a => Data.Yaml.FilePath.ParseYamlFile (Data.Yaml.FilePath.NonEmptyVector a) instance Data.Yaml.FilePath.ParseYamlFile GHC.IO.FilePath instance (Data.Yaml.FilePath.ParseYamlFile a, GHC.Classes.Ord a) => Data.Yaml.FilePath.ParseYamlFile (Data.Set.Internal.Set a) instance Data.Yaml.FilePath.ParseYamlFile a => Data.Yaml.FilePath.ParseYamlFile (Data.Vector.Vector a) module Keter.LabelMap -- | A data structure for storing a hierarchical set of domain labels from -- TLD down, supporting wildcards. -- -- Data structure is mutually recursive with LabelEntry, and each -- level of the tree supports a static assignment for a hostname such as: -- --
--   example.com
--   
-- -- Or a wildcard assignment for a hostname such as: -- --
--   *.example.com
--   
-- -- Or a wildcard assignment with a set of teptions, for example: -- --
--   *.example.com
--   admin.example.com
--   
-- -- And lastly, empty labels are supported so that, of course, an -- assignment for example.com does not necessarily have any subdomains -- available. As an example suppose we have the following assigned -- domains: -- --
--           example.com
--       foo.example.com
--     *.bar.example.com
--     *.qux.example.com
--   baz.qux.example.com
--   
-- -- This will resolve to the following value, with some loose pseudocode -- notation. -- --
--   Static (map)
--     'com' -> Unassigned Static (map)
--       'example' -> Assigned a (map)
--          'foo'  -> Assigned a EmptyLabelMap
--          'bar'  -> Unassigned (Wildcard (Assigned a EmptyLabelMap)
--          'qux'  -> Unassigned (WildcardExcept (Assigned a (map)))
--            'baz' -> Assigned a EmptyLabelMap
--   
-- -- Note that the hostname "bar.example.com" is unassigned, only the -- wildcard was set. data LabelMap a insert :: ByteString -> a -> LabelMap a -> LabelMap a delete :: ByteString -> LabelMap a -> LabelMap a lookup :: ByteString -> LabelMap a -> Maybe a labelAssigned :: ByteString -> LabelMap a -> Bool empty :: LabelMap a instance GHC.Classes.Eq a => GHC.Classes.Eq (Keter.LabelMap.LabelMap a) instance GHC.Show.Show (Keter.LabelMap.LabelMap a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Keter.LabelMap.LabelEntry a) instance GHC.Show.Show (Keter.LabelMap.LabelEntry a) module Keter.Types.Common data SSLConfig SSLFalse :: SSLConfig SSLTrue :: SSLConfig SSL :: !FilePath -> !Vector FilePath -> !FilePath -> SSLConfig data AppId AIBuiltin :: AppId AINamed :: !Appname -> AppId data KeterException CannotParsePostgres :: FilePath -> KeterException ExitCodeFailure :: FilePath -> ExitCode -> KeterException NoPortsAvailable :: KeterException InvalidConfigFile :: ParseException -> KeterException InvalidKeterConfigFile :: !FilePath -> !ParseException -> KeterException CannotReserveHosts :: !AppId -> !Map Host AppId -> KeterException FileNotExecutable :: !FilePath -> KeterException ExecutableNotFound :: !FilePath -> KeterException EnsureAliveShouldBeBiggerThenZero :: !Int -> KeterException [keterExceptionGot] :: KeterException -> !Int data LogMessage ProcessCreated :: FilePath -> LogMessage InvalidBundle :: FilePath -> SomeException -> LogMessage ProcessDidNotStart :: FilePath -> LogMessage ExceptionThrown :: Text -> SomeException -> LogMessage RemovingPort :: Int -> LogMessage UnpackingBundle :: FilePath -> LogMessage TerminatingApp :: Text -> LogMessage FinishedReloading :: Text -> LogMessage TerminatingOldProcess :: AppId -> LogMessage RemovingOldFolder :: FilePath -> LogMessage ReceivedInotifyEvent :: Text -> LogMessage ProcessWaiting :: FilePath -> LogMessage OtherMessage :: Text -> LogMessage ErrorStartingBundle :: Text -> SomeException -> LogMessage SanityChecksPassed :: LogMessage ReservingHosts :: AppId -> Set Host -> LogMessage ForgetingReservations :: AppId -> Set Host -> LogMessage ActivatingApp :: AppId -> Set Host -> LogMessage DeactivatingApp :: AppId -> Set Host -> LogMessage ReactivatingApp :: AppId -> Set Host -> Set Host -> LogMessage WatchedFile :: Text -> FilePath -> LogMessage ReloadFrom :: Maybe String -> String -> LogMessage Terminating :: String -> LogMessage LaunchInitial :: LogMessage LaunchCli :: LogMessage StartWatching :: LogMessage StartListening :: LogMessage BindCli :: AddrInfo -> LogMessage ReceivedCliConnection :: SockAddr -> LogMessage KillingApp :: Port -> Text -> LogMessage type HostBS = CI ByteString -- | A virtual host we want to serve content from. type Host = CI Text -- | A port for an individual app to listen on. type Port = Int -- | Used for versioning data types. class ToCurrent a where { type family Previous a; } toCurrent :: ToCurrent a => Previous a -> a type Plugins = [Plugin] data Plugin Plugin :: (Appname -> Object -> IO [(Text, Text)]) -> Plugin [pluginGetEnv] :: Plugin -> Appname -> Object -> IO [(Text, Text)] -- | Name of the application. Should just be the basename of the -- application file. type Appname = Text getAppname :: FilePath -> Text logEx :: Q Exp -- | File and directory names are values of type String, whose -- precise meaning is operating system dependent. Files can be opened, -- yielding a handle which can then be used to operate on the contents of -- that file. type FilePath = String -- | A space efficient, packed, unboxed Unicode text type. data Text -- | A space-efficient representation of a Word8 vector, supporting -- many efficient operations. -- -- A ByteString contains 8-bit bytes, or by using the operations -- from Data.ByteString.Char8 it can be interpreted as containing -- 8-bit characters. data ByteString -- | A set of values a. data Set a -- | A Map from keys k to values a. -- -- The Semigroup operation for Map is union, which -- prefers values from the left operand. If m1 maps a key -- k to a value a1, and m2 maps the same key -- to a different value a2, then their union m1 <> -- m2 maps k to a1. data Map k a -- | Any type that you wish to throw or catch as an exception must be an -- instance of the Exception class. The simplest case is a new -- exception type directly below the root: -- --
--   data MyException = ThisException | ThatException
--       deriving Show
--   
--   instance Exception MyException
--   
-- -- The default method definitions in the Exception class do what -- we need in this case. You can now throw and catch -- ThisException and ThatException as exceptions: -- --
--   *Main> throw ThisException `catch` \e -> putStrLn ("Caught " ++ show (e :: MyException))
--   Caught ThisException
--   
-- -- In more complicated examples, you may wish to define a whole hierarchy -- of exceptions: -- --
--   ---------------------------------------------------------------------
--   -- Make the root exception type for all the exceptions in a compiler
--   
--   data SomeCompilerException = forall e . Exception e => SomeCompilerException e
--   
--   instance Show SomeCompilerException where
--       show (SomeCompilerException e) = show e
--   
--   instance Exception SomeCompilerException
--   
--   compilerExceptionToException :: Exception e => e -> SomeException
--   compilerExceptionToException = toException . SomeCompilerException
--   
--   compilerExceptionFromException :: Exception e => SomeException -> Maybe e
--   compilerExceptionFromException x = do
--       SomeCompilerException a <- fromException x
--       cast a
--   
--   ---------------------------------------------------------------------
--   -- Make a subhierarchy for exceptions in the frontend of the compiler
--   
--   data SomeFrontendException = forall e . Exception e => SomeFrontendException e
--   
--   instance Show SomeFrontendException where
--       show (SomeFrontendException e) = show e
--   
--   instance Exception SomeFrontendException where
--       toException = compilerExceptionToException
--       fromException = compilerExceptionFromException
--   
--   frontendExceptionToException :: Exception e => e -> SomeException
--   frontendExceptionToException = toException . SomeFrontendException
--   
--   frontendExceptionFromException :: Exception e => SomeException -> Maybe e
--   frontendExceptionFromException x = do
--       SomeFrontendException a <- fromException x
--       cast a
--   
--   ---------------------------------------------------------------------
--   -- Make an exception type for a particular frontend compiler exception
--   
--   data MismatchedParentheses = MismatchedParentheses
--       deriving Show
--   
--   instance Exception MismatchedParentheses where
--       toException   = frontendExceptionToException
--       fromException = frontendExceptionFromException
--   
-- -- We can now catch a MismatchedParentheses exception as -- MismatchedParentheses, SomeFrontendException or -- SomeCompilerException, but not other types, e.g. -- IOException: -- --
--   *Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: MismatchedParentheses))
--   Caught MismatchedParentheses
--   *Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: SomeFrontendException))
--   Caught MismatchedParentheses
--   *Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: SomeCompilerException))
--   Caught MismatchedParentheses
--   *Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: IOException))
--   *** Exception: MismatchedParentheses
--   
class (Typeable e, Show e) => Exception e -- | The SomeException type is the root of the exception type -- hierarchy. When an exception of type e is thrown, behind the -- scenes it is encapsulated in a SomeException. data SomeException instance GHC.Classes.Ord Keter.Types.Common.AppId instance GHC.Classes.Eq Keter.Types.Common.AppId instance GHC.Show.Show Keter.Types.Common.KeterException instance GHC.Classes.Ord Keter.Types.Common.SSLConfig instance GHC.Classes.Eq Keter.Types.Common.SSLConfig instance GHC.Show.Show Keter.Types.Common.SSLConfig instance Data.Yaml.FilePath.ParseYamlFile Keter.Types.Common.SSLConfig instance Data.Aeson.Types.ToJSON.ToJSON Keter.Types.Common.SSLConfig instance Data.Aeson.Types.FromJSON.FromJSON Keter.Types.Common.SSLConfig instance GHC.Show.Show Keter.Types.Common.LogMessage instance GHC.Exception.Type.Exception Keter.Types.Common.KeterException instance GHC.Show.Show Keter.Types.Common.AppId instance Keter.Types.Common.ToCurrent a => Keter.Types.Common.ToCurrent (GHC.Maybe.Maybe a) module Keter.Types.Middleware data MiddlewareConfig AcceptOverride :: MiddlewareConfig Autohead :: MiddlewareConfig Jsonp :: MiddlewareConfig MethodOverride :: MiddlewareConfig MethodOverridePost :: MiddlewareConfig AddHeaders :: ![(ByteString, ByteString)] -> MiddlewareConfig -- | Realm [(username,password)] BasicAuth :: !String -> ![(ByteString, ByteString)] -> MiddlewareConfig -- | Status Message Local :: !Int -> !ByteString -> MiddlewareConfig processMiddleware :: [MiddlewareConfig] -> Middleware toMiddleware :: MiddlewareConfig -> Middleware composeMiddleware :: [Middleware] -> Middleware instance GHC.Generics.Generic Keter.Types.Middleware.MiddlewareConfig instance GHC.Show.Show Keter.Types.Middleware.MiddlewareConfig instance Data.Aeson.Types.FromJSON.FromJSON Keter.Types.Middleware.MiddlewareConfig instance Data.Aeson.Types.ToJSON.ToJSON Keter.Types.Middleware.MiddlewareConfig module Network.HTTP.ReverseProxy.Rewrite data ReverseProxyConfig ReverseProxyConfig :: Text -> Int -> Bool -> Text -> !SSLConfig -> Maybe Int -> Set RewriteRule -> Set RewriteRule -> ReverseProxyConfig [reversedHost] :: ReverseProxyConfig -> Text [reversedPort] :: ReverseProxyConfig -> Int [reversedUseSSL] :: ReverseProxyConfig -> Bool [reversingHost] :: ReverseProxyConfig -> Text [reversingUseSSL] :: ReverseProxyConfig -> !SSLConfig [reverseTimeout] :: ReverseProxyConfig -> Maybe Int [rewriteResponseRules] :: ReverseProxyConfig -> Set RewriteRule [rewriteRequestRules] :: ReverseProxyConfig -> Set RewriteRule data RewriteRule RewriteRule :: Text -> Text -> Text -> RewriteRule [ruleHeader] :: RewriteRule -> Text [ruleRegex] :: RewriteRule -> Text [ruleReplacement] :: RewriteRule -> Text data RPEntry RPEntry :: ReverseProxyConfig -> Manager -> RPEntry [config] :: RPEntry -> ReverseProxyConfig [httpManager] :: RPEntry -> Manager simpleReverseProxy :: Manager -> ReverseProxyConfig -> Application instance GHC.Show.Show Network.HTTP.ReverseProxy.Rewrite.RewriteRule instance GHC.Classes.Ord Network.HTTP.ReverseProxy.Rewrite.RewriteRule instance GHC.Classes.Eq Network.HTTP.ReverseProxy.Rewrite.RewriteRule instance GHC.Show.Show Network.HTTP.ReverseProxy.Rewrite.ReverseProxyConfig instance GHC.Classes.Ord Network.HTTP.ReverseProxy.Rewrite.ReverseProxyConfig instance GHC.Classes.Eq Network.HTTP.ReverseProxy.Rewrite.ReverseProxyConfig instance GHC.Show.Show Network.HTTP.ReverseProxy.Rewrite.RPEntry instance Data.Aeson.Types.FromJSON.FromJSON Network.HTTP.ReverseProxy.Rewrite.ReverseProxyConfig instance Data.Aeson.Types.ToJSON.ToJSON Network.HTTP.ReverseProxy.Rewrite.ReverseProxyConfig instance Data.Default.Class.Default Network.HTTP.ReverseProxy.Rewrite.ReverseProxyConfig instance Data.Aeson.Types.FromJSON.FromJSON Network.HTTP.ReverseProxy.Rewrite.RewriteRule instance Data.Aeson.Types.ToJSON.ToJSON Network.HTTP.ReverseProxy.Rewrite.RewriteRule -- | Legacy types from Keter version 0.4. Retained to keep backwards -- compatibility in config file format. module Keter.Types.V04 data AppConfig AppConfig :: FilePath -> [Text] -> Text -> Bool -> Set Text -> Object -> AppConfig [configExec] :: AppConfig -> FilePath [configArgs] :: AppConfig -> [Text] [configHost] :: AppConfig -> Text [configSsl] :: AppConfig -> Bool [configExtraHosts] :: AppConfig -> Set Text [configRaw] :: AppConfig -> Object data BundleConfig BundleConfig :: Maybe AppConfig -> Set StaticHost -> Set Redirect -> BundleConfig [bconfigApp] :: BundleConfig -> Maybe AppConfig [bconfigStaticHosts] :: BundleConfig -> Set StaticHost [bconfigRedirects] :: BundleConfig -> Set Redirect data StaticHost StaticHost :: Text -> FilePath -> StaticHost [shHost] :: StaticHost -> Text [shRoot] :: StaticHost -> FilePath data Redirect Redirect :: Text -> Text -> Redirect [redFrom] :: Redirect -> Text [redTo] :: Redirect -> Text data KeterConfig KeterConfig :: FilePath -> PortSettings -> HostPreference -> Port -> Maybe TLSConfig -> Maybe Text -> Set ReverseProxyConfig -> Bool -> Int -> KeterConfig [kconfigDir] :: KeterConfig -> FilePath [kconfigPortMan] :: KeterConfig -> PortSettings [kconfigHost] :: KeterConfig -> HostPreference [kconfigPort] :: KeterConfig -> Port [kconfigSsl] :: KeterConfig -> Maybe TLSConfig [kconfigSetuid] :: KeterConfig -> Maybe Text [kconfigReverseProxy] :: KeterConfig -> Set ReverseProxyConfig [kconfigIpFromHeader] :: KeterConfig -> Bool -- | Maximum request time in milliseconds per connection. [kconfigConnectionTimeBound] :: KeterConfig -> Int -- | Default connection time bound in milliseconds. fiveMinutes :: Int data TLSConfig TLSConfig :: !Settings -> !FilePath -> !FilePath -> Maybe Config -> TLSConfig -- | Controls execution of the nginx thread. Follows the settings type -- pattern. See: http://www.yesodweb.com/book/settings-types. data PortSettings PortSettings :: [Port] -> PortSettings -- | Which ports to assign to apps. Defaults to unassigned ranges from IANA [portRange] :: PortSettings -> [Port] instance GHC.Classes.Ord Keter.Types.V04.StaticHost instance GHC.Classes.Eq Keter.Types.V04.StaticHost instance GHC.Classes.Ord Keter.Types.V04.Redirect instance GHC.Classes.Eq Keter.Types.V04.Redirect instance Data.Default.Class.Default Keter.Types.V04.KeterConfig instance Data.Yaml.FilePath.ParseYamlFile Keter.Types.V04.KeterConfig instance Data.Default.Class.Default Keter.Types.V04.PortSettings instance Data.Aeson.Types.FromJSON.FromJSON Keter.Types.V04.PortSettings instance Data.Yaml.FilePath.ParseYamlFile Keter.Types.V04.TLSConfig instance Data.Yaml.FilePath.ParseYamlFile Keter.Types.V04.BundleConfig instance Data.Aeson.Types.FromJSON.FromJSON Keter.Types.V04.Redirect instance Data.Yaml.FilePath.ParseYamlFile Keter.Types.V04.StaticHost instance Data.Yaml.FilePath.ParseYamlFile Keter.Types.V04.AppConfig module Keter.Types.V10 data BundleConfig BundleConfig :: !Vector (Stanza ()) -> !Object -> BundleConfig [bconfigStanzas] :: BundleConfig -> !Vector (Stanza ()) -- | settings used for plugins [bconfigPlugins] :: BundleConfig -> !Object data ListeningPort LPSecure :: !HostPreference -> !Port -> !FilePath -> !Vector FilePath -> !FilePath -> !Bool -> ListeningPort LPInsecure :: !HostPreference -> !Port -> ListeningPort data KeterConfig KeterConfig :: FilePath -> PortSettings -> !NonEmptyVector ListeningPort -> Maybe Text -> !Vector (Stanza ()) -> Bool -> !Int -> !Int -> !Map Text Text -> !Int -> !Maybe Port -> KeterConfig [kconfigDir] :: KeterConfig -> FilePath [kconfigPortPool] :: KeterConfig -> PortSettings [kconfigListeners] :: KeterConfig -> !NonEmptyVector ListeningPort [kconfigSetuid] :: KeterConfig -> Maybe Text [kconfigBuiltinStanzas] :: KeterConfig -> !Vector (Stanza ()) [kconfigIpFromHeader] :: KeterConfig -> Bool -- | External HTTP port when generating APPROOTs. [kconfigExternalHttpPort] :: KeterConfig -> !Int -- | External HTTPS port when generating APPROOTs. [kconfigExternalHttpsPort] :: KeterConfig -> !Int -- | Environment variables to be passed to all apps. [kconfigEnvironment] :: KeterConfig -> !Map Text Text -- | Maximum request time in milliseconds per connection. [kconfigConnectionTimeBound] :: KeterConfig -> !Int -- | Port for the cli to listen on [kconfigCliPort] :: KeterConfig -> !Maybe Port -- | Whether we should force redirect to HTTPS routes. type RequiresSecure = Bool data Stanza port Stanza :: StanzaRaw port -> RequiresSecure -> Stanza port data StanzaRaw port StanzaStaticFiles :: !StaticFilesConfig -> StanzaRaw port StanzaRedirect :: !RedirectConfig -> StanzaRaw port StanzaWebApp :: !WebAppConfig port -> StanzaRaw port StanzaReverseProxy :: !ReverseProxyConfig -> ![MiddlewareConfig] -> !Maybe Int -> StanzaRaw port StanzaBackground :: !BackgroundConfig -> StanzaRaw port -- | An action to be performed for a requested hostname. -- -- This datatype is very similar to Stanza, but is necessarily separate -- since: -- --
    --
  1. Webapps will be assigned ports.
  2. --
  3. Not all stanzas have an associated proxy action.
  4. --
data ProxyActionRaw PAPort :: Port -> !Maybe Int -> ProxyActionRaw PAStatic :: StaticFilesConfig -> ProxyActionRaw PARedirect :: RedirectConfig -> ProxyActionRaw PAReverseProxy :: ReverseProxyConfig -> ![MiddlewareConfig] -> !Maybe Int -> ProxyActionRaw type ProxyAction = (ProxyActionRaw, RequiresSecure) addRequiresSecure :: ToJSON a => Bool -> a -> Value addStanzaType :: ToJSON a => Value -> a -> Value data StaticFilesConfig StaticFilesConfig :: !FilePath -> !Set Host -> !Bool -> ![MiddlewareConfig] -> !Maybe Int -> !SSLConfig -> StaticFilesConfig [sfconfigRoot] :: StaticFilesConfig -> !FilePath [sfconfigHosts] :: StaticFilesConfig -> !Set Host [sfconfigListings] :: StaticFilesConfig -> !Bool [sfconfigMiddleware] :: StaticFilesConfig -> ![MiddlewareConfig] [sfconfigTimeout] :: StaticFilesConfig -> !Maybe Int [sfconfigSsl] :: StaticFilesConfig -> !SSLConfig data RedirectConfig RedirectConfig :: !Set Host -> !Int -> !Vector RedirectAction -> !SSLConfig -> RedirectConfig [redirconfigHosts] :: RedirectConfig -> !Set Host [redirconfigStatus] :: RedirectConfig -> !Int [redirconfigActions] :: RedirectConfig -> !Vector RedirectAction [redirconfigSsl] :: RedirectConfig -> !SSLConfig data RedirectAction RedirectAction :: !SourcePath -> !RedirectDest -> RedirectAction data SourcePath SPAny :: SourcePath SPSpecific :: !Text -> SourcePath data RedirectDest RDUrl :: !Text -> RedirectDest RDPrefix :: !IsSecure -> !Host -> !Maybe Port -> RedirectDest type IsSecure = Bool data WebAppConfig port WebAppConfig :: !FilePath -> !Vector Text -> !Map Text Text -> !Host -> !Set Host -> !SSLConfig -> !port -> !Set Text -> !Maybe Int -> !Maybe Int -> WebAppConfig port [waconfigExec] :: WebAppConfig port -> !FilePath [waconfigArgs] :: WebAppConfig port -> !Vector Text [waconfigEnvironment] :: WebAppConfig port -> !Map Text Text -- | primary host, used for approot [waconfigApprootHost] :: WebAppConfig port -> !Host -- | all hosts, not including the approot host [waconfigHosts] :: WebAppConfig port -> !Set Host [waconfigSsl] :: WebAppConfig port -> !SSLConfig [waconfigPort] :: WebAppConfig port -> !port [waconfigForwardEnv] :: WebAppConfig port -> !Set Text -- | how long are connections supposed to last [waconfigTimeout] :: WebAppConfig port -> !Maybe Int -- | how long in microseconds the app gets before we expect it to bind to a -- port (default 90 seconds) [waconfigEnsureAliveTimeout] :: WebAppConfig port -> !Maybe Int data AppInput AIBundle :: !FilePath -> !EpochTime -> AppInput AIData :: !BundleConfig -> AppInput data BackgroundConfig BackgroundConfig :: !FilePath -> !Vector Text -> !Map Text Text -> !RestartCount -> !Word -> !Set Text -> BackgroundConfig [bgconfigExec] :: BackgroundConfig -> !FilePath [bgconfigArgs] :: BackgroundConfig -> !Vector Text [bgconfigEnvironment] :: BackgroundConfig -> !Map Text Text [bgconfigRestartCount] :: BackgroundConfig -> !RestartCount [bgconfigRestartDelaySeconds] :: BackgroundConfig -> !Word [bgconfigForwardEnv] :: BackgroundConfig -> !Set Text data RestartCount UnlimitedRestarts :: RestartCount LimitedRestarts :: !Word -> RestartCount instance GHC.Show.Show Keter.Types.V10.StaticFilesConfig instance GHC.Show.Show Keter.Types.V10.SourcePath instance GHC.Show.Show Keter.Types.V10.RedirectDest instance GHC.Show.Show Keter.Types.V10.RedirectAction instance GHC.Show.Show Keter.Types.V10.RedirectConfig instance GHC.Show.Show Keter.Types.V10.ProxyActionRaw instance GHC.Show.Show port => GHC.Show.Show (Keter.Types.V10.WebAppConfig port) instance GHC.Show.Show Keter.Types.V10.RestartCount instance GHC.Show.Show Keter.Types.V10.BackgroundConfig instance GHC.Show.Show port => GHC.Show.Show (Keter.Types.V10.StanzaRaw port) instance GHC.Show.Show port => GHC.Show.Show (Keter.Types.V10.Stanza port) instance GHC.Show.Show Keter.Types.V10.BundleConfig instance GHC.Show.Show Keter.Types.V10.AppInput instance Keter.Types.Common.ToCurrent Keter.Types.V10.BundleConfig instance Data.Yaml.FilePath.ParseYamlFile Keter.Types.V10.BundleConfig instance Data.Aeson.Types.ToJSON.ToJSON Keter.Types.V10.BundleConfig instance Keter.Types.Common.ToCurrent Keter.Types.V10.KeterConfig instance Data.Default.Class.Default Keter.Types.V10.KeterConfig instance Data.Yaml.FilePath.ParseYamlFile Keter.Types.V10.KeterConfig instance Data.Yaml.FilePath.ParseYamlFile (Keter.Types.V10.Stanza ()) instance Data.Aeson.Types.ToJSON.ToJSON (Keter.Types.V10.Stanza ()) instance Data.Aeson.Types.ToJSON.ToJSON (Keter.Types.V10.StanzaRaw ()) instance Data.Yaml.FilePath.ParseYamlFile Keter.Types.V10.BackgroundConfig instance Data.Aeson.Types.ToJSON.ToJSON Keter.Types.V10.BackgroundConfig instance Data.Aeson.Types.FromJSON.FromJSON Keter.Types.V10.RestartCount instance Keter.Types.Common.ToCurrent (Keter.Types.V10.WebAppConfig ()) instance Data.Yaml.FilePath.ParseYamlFile (Keter.Types.V10.WebAppConfig ()) instance Data.Aeson.Types.ToJSON.ToJSON (Keter.Types.V10.WebAppConfig ()) instance Keter.Types.Common.ToCurrent Keter.Types.V10.RedirectConfig instance Data.Yaml.FilePath.ParseYamlFile Keter.Types.V10.RedirectConfig instance Data.Aeson.Types.ToJSON.ToJSON Keter.Types.V10.RedirectConfig instance Data.Aeson.Types.FromJSON.FromJSON Keter.Types.V10.RedirectAction instance Data.Aeson.Types.ToJSON.ToJSON Keter.Types.V10.RedirectAction instance Data.Aeson.Types.FromJSON.FromJSON Keter.Types.V10.RedirectDest instance Data.Aeson.Types.ToJSON.ToJSON Keter.Types.V10.RedirectDest instance Keter.Types.Common.ToCurrent Keter.Types.V10.StaticFilesConfig instance Data.Yaml.FilePath.ParseYamlFile Keter.Types.V10.StaticFilesConfig instance Data.Aeson.Types.ToJSON.ToJSON Keter.Types.V10.StaticFilesConfig instance Data.Yaml.FilePath.ParseYamlFile Keter.Types.V10.ListeningPort module Keter.Types -- | A space-efficient representation of a Word8 vector, supporting -- many efficient operations. -- -- A ByteString contains 8-bit bytes, or by using the operations -- from Data.ByteString.Char8 it can be interpreted as containing -- 8-bit characters. data ByteString -- | A space efficient, packed, unboxed Unicode text type. data Text -- | A Map from keys k to values a. -- -- The Semigroup operation for Map is union, which -- prefers values from the left operand. If m1 maps a key -- k to a value a1, and m2 maps the same key -- to a different value a2, then their union m1 <> -- m2 maps k to a1. data Map k a -- | File and directory names are values of type String, whose -- precise meaning is operating system dependent. Files can be opened, -- yielding a handle which can then be used to operate on the contents of -- that file. type FilePath = String -- | Any type that you wish to throw or catch as an exception must be an -- instance of the Exception class. The simplest case is a new -- exception type directly below the root: -- --
--   data MyException = ThisException | ThatException
--       deriving Show
--   
--   instance Exception MyException
--   
-- -- The default method definitions in the Exception class do what -- we need in this case. You can now throw and catch -- ThisException and ThatException as exceptions: -- --
--   *Main> throw ThisException `catch` \e -> putStrLn ("Caught " ++ show (e :: MyException))
--   Caught ThisException
--   
-- -- In more complicated examples, you may wish to define a whole hierarchy -- of exceptions: -- --
--   ---------------------------------------------------------------------
--   -- Make the root exception type for all the exceptions in a compiler
--   
--   data SomeCompilerException = forall e . Exception e => SomeCompilerException e
--   
--   instance Show SomeCompilerException where
--       show (SomeCompilerException e) = show e
--   
--   instance Exception SomeCompilerException
--   
--   compilerExceptionToException :: Exception e => e -> SomeException
--   compilerExceptionToException = toException . SomeCompilerException
--   
--   compilerExceptionFromException :: Exception e => SomeException -> Maybe e
--   compilerExceptionFromException x = do
--       SomeCompilerException a <- fromException x
--       cast a
--   
--   ---------------------------------------------------------------------
--   -- Make a subhierarchy for exceptions in the frontend of the compiler
--   
--   data SomeFrontendException = forall e . Exception e => SomeFrontendException e
--   
--   instance Show SomeFrontendException where
--       show (SomeFrontendException e) = show e
--   
--   instance Exception SomeFrontendException where
--       toException = compilerExceptionToException
--       fromException = compilerExceptionFromException
--   
--   frontendExceptionToException :: Exception e => e -> SomeException
--   frontendExceptionToException = toException . SomeFrontendException
--   
--   frontendExceptionFromException :: Exception e => SomeException -> Maybe e
--   frontendExceptionFromException x = do
--       SomeFrontendException a <- fromException x
--       cast a
--   
--   ---------------------------------------------------------------------
--   -- Make an exception type for a particular frontend compiler exception
--   
--   data MismatchedParentheses = MismatchedParentheses
--       deriving Show
--   
--   instance Exception MismatchedParentheses where
--       toException   = frontendExceptionToException
--       fromException = frontendExceptionFromException
--   
-- -- We can now catch a MismatchedParentheses exception as -- MismatchedParentheses, SomeFrontendException or -- SomeCompilerException, but not other types, e.g. -- IOException: -- --
--   *Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: MismatchedParentheses))
--   Caught MismatchedParentheses
--   *Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: SomeFrontendException))
--   Caught MismatchedParentheses
--   *Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: SomeCompilerException))
--   Caught MismatchedParentheses
--   *Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: IOException))
--   *** Exception: MismatchedParentheses
--   
class (Typeable e, Show e) => Exception e -- | The SomeException type is the root of the exception type -- hierarchy. When an exception of type e is thrown, behind the -- scenes it is encapsulated in a SomeException. data SomeException -- | A set of values a. data Set a data SSLConfig SSLFalse :: SSLConfig SSLTrue :: SSLConfig SSL :: !FilePath -> !Vector FilePath -> !FilePath -> SSLConfig data AppId AIBuiltin :: AppId AINamed :: !Appname -> AppId data KeterException CannotParsePostgres :: FilePath -> KeterException ExitCodeFailure :: FilePath -> ExitCode -> KeterException NoPortsAvailable :: KeterException InvalidConfigFile :: ParseException -> KeterException InvalidKeterConfigFile :: !FilePath -> !ParseException -> KeterException CannotReserveHosts :: !AppId -> !Map Host AppId -> KeterException FileNotExecutable :: !FilePath -> KeterException ExecutableNotFound :: !FilePath -> KeterException EnsureAliveShouldBeBiggerThenZero :: !Int -> KeterException [keterExceptionGot] :: KeterException -> !Int data LogMessage ProcessCreated :: FilePath -> LogMessage InvalidBundle :: FilePath -> SomeException -> LogMessage ProcessDidNotStart :: FilePath -> LogMessage ExceptionThrown :: Text -> SomeException -> LogMessage RemovingPort :: Int -> LogMessage UnpackingBundle :: FilePath -> LogMessage TerminatingApp :: Text -> LogMessage FinishedReloading :: Text -> LogMessage TerminatingOldProcess :: AppId -> LogMessage RemovingOldFolder :: FilePath -> LogMessage ReceivedInotifyEvent :: Text -> LogMessage ProcessWaiting :: FilePath -> LogMessage OtherMessage :: Text -> LogMessage ErrorStartingBundle :: Text -> SomeException -> LogMessage SanityChecksPassed :: LogMessage ReservingHosts :: AppId -> Set Host -> LogMessage ForgetingReservations :: AppId -> Set Host -> LogMessage ActivatingApp :: AppId -> Set Host -> LogMessage DeactivatingApp :: AppId -> Set Host -> LogMessage ReactivatingApp :: AppId -> Set Host -> Set Host -> LogMessage WatchedFile :: Text -> FilePath -> LogMessage ReloadFrom :: Maybe String -> String -> LogMessage Terminating :: String -> LogMessage LaunchInitial :: LogMessage LaunchCli :: LogMessage StartWatching :: LogMessage StartListening :: LogMessage BindCli :: AddrInfo -> LogMessage ReceivedCliConnection :: SockAddr -> LogMessage KillingApp :: Port -> Text -> LogMessage type HostBS = CI ByteString -- | A virtual host we want to serve content from. type Host = CI Text -- | A port for an individual app to listen on. type Port = Int -- | Used for versioning data types. class ToCurrent a where { type family Previous a; } toCurrent :: ToCurrent a => Previous a -> a type Plugins = [Plugin] data Plugin Plugin :: (Appname -> Object -> IO [(Text, Text)]) -> Plugin [pluginGetEnv] :: Plugin -> Appname -> Object -> IO [(Text, Text)] -- | Name of the application. Should just be the basename of the -- application file. type Appname = Text getAppname :: FilePath -> Text logEx :: Q Exp data RewriteRule RewriteRule :: Text -> Text -> Text -> RewriteRule [ruleHeader] :: RewriteRule -> Text [ruleRegex] :: RewriteRule -> Text [ruleReplacement] :: RewriteRule -> Text data ReverseProxyConfig ReverseProxyConfig :: Text -> Int -> Bool -> Text -> !SSLConfig -> Maybe Int -> Set RewriteRule -> Set RewriteRule -> ReverseProxyConfig [reversedHost] :: ReverseProxyConfig -> Text [reversedPort] :: ReverseProxyConfig -> Int [reversedUseSSL] :: ReverseProxyConfig -> Bool [reversingHost] :: ReverseProxyConfig -> Text [reversingUseSSL] :: ReverseProxyConfig -> !SSLConfig [reverseTimeout] :: ReverseProxyConfig -> Maybe Int [rewriteResponseRules] :: ReverseProxyConfig -> Set RewriteRule [rewriteRequestRules] :: ReverseProxyConfig -> Set RewriteRule -- | Controls execution of the nginx thread. Follows the settings type -- pattern. See: http://www.yesodweb.com/book/settings-types. data PortSettings PortSettings :: [Port] -> PortSettings -- | Which ports to assign to apps. Defaults to unassigned ranges from IANA [portRange] :: PortSettings -> [Port] data TLSConfig TLSConfig :: !Settings -> !FilePath -> !FilePath -> Maybe Config -> TLSConfig data RestartCount UnlimitedRestarts :: RestartCount LimitedRestarts :: !Word -> RestartCount data BackgroundConfig BackgroundConfig :: !FilePath -> !Vector Text -> !Map Text Text -> !RestartCount -> !Word -> !Set Text -> BackgroundConfig [bgconfigExec] :: BackgroundConfig -> !FilePath [bgconfigArgs] :: BackgroundConfig -> !Vector Text [bgconfigEnvironment] :: BackgroundConfig -> !Map Text Text [bgconfigRestartCount] :: BackgroundConfig -> !RestartCount [bgconfigRestartDelaySeconds] :: BackgroundConfig -> !Word [bgconfigForwardEnv] :: BackgroundConfig -> !Set Text data AppInput AIBundle :: !FilePath -> !EpochTime -> AppInput AIData :: !BundleConfig -> AppInput data WebAppConfig port WebAppConfig :: !FilePath -> !Vector Text -> !Map Text Text -> !Host -> !Set Host -> !SSLConfig -> !port -> !Set Text -> !Maybe Int -> !Maybe Int -> WebAppConfig port [waconfigExec] :: WebAppConfig port -> !FilePath [waconfigArgs] :: WebAppConfig port -> !Vector Text [waconfigEnvironment] :: WebAppConfig port -> !Map Text Text -- | primary host, used for approot [waconfigApprootHost] :: WebAppConfig port -> !Host -- | all hosts, not including the approot host [waconfigHosts] :: WebAppConfig port -> !Set Host [waconfigSsl] :: WebAppConfig port -> !SSLConfig [waconfigPort] :: WebAppConfig port -> !port [waconfigForwardEnv] :: WebAppConfig port -> !Set Text -- | how long are connections supposed to last [waconfigTimeout] :: WebAppConfig port -> !Maybe Int -- | how long in microseconds the app gets before we expect it to bind to a -- port (default 90 seconds) [waconfigEnsureAliveTimeout] :: WebAppConfig port -> !Maybe Int data RedirectDest RDUrl :: !Text -> RedirectDest RDPrefix :: !IsSecure -> !Host -> !Maybe Port -> RedirectDest data SourcePath SPAny :: SourcePath SPSpecific :: !Text -> SourcePath data RedirectAction RedirectAction :: !SourcePath -> !RedirectDest -> RedirectAction data RedirectConfig RedirectConfig :: !Set Host -> !Int -> !Vector RedirectAction -> !SSLConfig -> RedirectConfig [redirconfigHosts] :: RedirectConfig -> !Set Host [redirconfigStatus] :: RedirectConfig -> !Int [redirconfigActions] :: RedirectConfig -> !Vector RedirectAction [redirconfigSsl] :: RedirectConfig -> !SSLConfig data StaticFilesConfig StaticFilesConfig :: !FilePath -> !Set Host -> !Bool -> ![MiddlewareConfig] -> !Maybe Int -> !SSLConfig -> StaticFilesConfig [sfconfigRoot] :: StaticFilesConfig -> !FilePath [sfconfigHosts] :: StaticFilesConfig -> !Set Host [sfconfigListings] :: StaticFilesConfig -> !Bool [sfconfigMiddleware] :: StaticFilesConfig -> ![MiddlewareConfig] [sfconfigTimeout] :: StaticFilesConfig -> !Maybe Int [sfconfigSsl] :: StaticFilesConfig -> !SSLConfig type ProxyAction = (ProxyActionRaw, RequiresSecure) -- | An action to be performed for a requested hostname. -- -- This datatype is very similar to Stanza, but is necessarily separate -- since: -- --
    --
  1. Webapps will be assigned ports.
  2. --
  3. Not all stanzas have an associated proxy action.
  4. --
data ProxyActionRaw PAPort :: Port -> !Maybe Int -> ProxyActionRaw PAStatic :: StaticFilesConfig -> ProxyActionRaw PARedirect :: RedirectConfig -> ProxyActionRaw PAReverseProxy :: ReverseProxyConfig -> ![MiddlewareConfig] -> !Maybe Int -> ProxyActionRaw data StanzaRaw port StanzaStaticFiles :: !StaticFilesConfig -> StanzaRaw port StanzaRedirect :: !RedirectConfig -> StanzaRaw port StanzaWebApp :: !WebAppConfig port -> StanzaRaw port StanzaReverseProxy :: !ReverseProxyConfig -> ![MiddlewareConfig] -> !Maybe Int -> StanzaRaw port StanzaBackground :: !BackgroundConfig -> StanzaRaw port data Stanza port Stanza :: StanzaRaw port -> RequiresSecure -> Stanza port -- | Whether we should force redirect to HTTPS routes. type RequiresSecure = Bool data KeterConfig KeterConfig :: FilePath -> PortSettings -> !NonEmptyVector ListeningPort -> Maybe Text -> !Vector (Stanza ()) -> Bool -> !Int -> !Int -> !Map Text Text -> !Int -> !Maybe Port -> KeterConfig [kconfigDir] :: KeterConfig -> FilePath [kconfigPortPool] :: KeterConfig -> PortSettings [kconfigListeners] :: KeterConfig -> !NonEmptyVector ListeningPort [kconfigSetuid] :: KeterConfig -> Maybe Text [kconfigBuiltinStanzas] :: KeterConfig -> !Vector (Stanza ()) [kconfigIpFromHeader] :: KeterConfig -> Bool -- | External HTTP port when generating APPROOTs. [kconfigExternalHttpPort] :: KeterConfig -> !Int -- | External HTTPS port when generating APPROOTs. [kconfigExternalHttpsPort] :: KeterConfig -> !Int -- | Environment variables to be passed to all apps. [kconfigEnvironment] :: KeterConfig -> !Map Text Text -- | Maximum request time in milliseconds per connection. [kconfigConnectionTimeBound] :: KeterConfig -> !Int -- | Port for the cli to listen on [kconfigCliPort] :: KeterConfig -> !Maybe Port data ListeningPort LPSecure :: !HostPreference -> !Port -> !FilePath -> !Vector FilePath -> !FilePath -> !Bool -> ListeningPort LPInsecure :: !HostPreference -> !Port -> ListeningPort data BundleConfig BundleConfig :: !Vector (Stanza ()) -> !Object -> BundleConfig [bconfigStanzas] :: BundleConfig -> !Vector (Stanza ()) -- | settings used for plugins [bconfigPlugins] :: BundleConfig -> !Object -- | Manages a pool of available ports and allocates them. module Keter.PortPool data PortPool -- | Gets an unassigned port number. getPort :: (LogMessage -> IO ()) -> PortPool -> IO (Either SomeException Port) -- | Return a port to the recycled collection of the pool. Note that -- recycling puts the new ports at the end of the queue (FIFO), so that -- if an application holds onto the port longer than expected, there -- should be no issues. releasePort :: PortPool -> Port -> IO () start :: PortSettings -> IO PortPool module Keter.Plugin.Postgres data Settings -- | How to create the given user/database. Default: uses the psql -- command line tool and sudo -u postgres. setupDBInfo :: Settings -> DBInfo -> IO () -- | Load a set of existing connections from a config file. If the file -- does not exist, it will be created. Any newly created databases will -- automatically be saved to this file. load :: Settings -> FilePath -> IO Plugin instance GHC.Show.Show Keter.Plugin.Postgres.DBServerInfo instance GHC.Show.Show Keter.Plugin.Postgres.DBInfo instance Data.Default.Class.Default Keter.Plugin.Postgres.Settings instance Data.Aeson.Types.ToJSON.ToJSON Keter.Plugin.Postgres.DBInfo instance Data.Aeson.Types.FromJSON.FromJSON Keter.Plugin.Postgres.DBInfo instance Data.Aeson.Types.FromJSON.FromJSON Keter.Plugin.Postgres.DBServerInfo instance Data.Default.Class.Default Keter.Plugin.Postgres.DBServerInfo module Keter.HostManager data HostManager type Reservations = Set Host -- | Reserve the given hosts so that no other application may use them. -- Does not yet enable any action. The semantics are: -- --
    --
  1. If a requested host is currently actively used or by an app of the -- same name, it is considered reserved.
  2. --
  3. If a requested host is currently reserved by an app of the same -- name, it is considered an error in calling this API. Only one app -- reservation can happen at a time.
  4. --
  5. If any requested host is currently used or reserved by an app with -- a different name, then those values are returned as -- Left.
  6. --
  7. Otherwise, the hosts which were reserved are returned as -- Right. This does not include previously active -- hosts.
  8. --
reserveHosts :: (LogMessage -> IO ()) -> HostManager -> AppId -> Set Host -> IO Reservations -- | Forget previously made reservations. forgetReservations :: (LogMessage -> IO ()) -> HostManager -> AppId -> Reservations -> IO () -- | Activate a new app. Note that you must first reserve the -- hostnames you'll be using. activateApp :: (LogMessage -> IO ()) -> HostManager -> AppId -> Map Host (ProxyAction, Credentials) -> IO () deactivateApp :: (LogMessage -> IO ()) -> HostManager -> AppId -> Set Host -> IO () reactivateApp :: (LogMessage -> IO ()) -> HostManager -> AppId -> Map Host (ProxyAction, Credentials) -> Set Host -> IO () lookupAction :: HostManager -> HostBS -> IO (Maybe (ProxyAction, Credentials)) start :: IO HostManager module Keter.App data App data AppStartConfig AppStartConfig :: !TempFolder -> !Maybe (Text, (UserID, GroupID)) -> !ProcessTracker -> !HostManager -> !PortPool -> !Plugins -> !LogMessage -> IO () -> !KeterConfig -> AppStartConfig [ascTempFolder] :: AppStartConfig -> !TempFolder [ascSetuid] :: AppStartConfig -> !Maybe (Text, (UserID, GroupID)) [ascProcessTracker] :: AppStartConfig -> !ProcessTracker [ascHostManager] :: AppStartConfig -> !HostManager [ascPortPool] :: AppStartConfig -> !PortPool [ascPlugins] :: AppStartConfig -> !Plugins [ascLog] :: AppStartConfig -> !LogMessage -> IO () [ascKeterConfig] :: AppStartConfig -> !KeterConfig start :: AppStartConfig -> AppId -> AppInput -> IO App reload :: App -> AppInput -> IO () -- | Get the modification time of the bundle file this app was launched -- from, if relevant. getTimestamp :: App -> STM (Maybe EpochTime) terminate :: App -> IO () -- | within an stm context we can show a lot more then the show instance -- can do showApp :: App -> STM Text instance GHC.Show.Show Keter.App.App instance GHC.Show.Show Keter.App.RunningWebApp -- | Used for management of applications. module Keter.AppManager data AppManager data Action Reload :: AppInput -> Action Terminate :: Action perform :: AppManager -> AppId -> Action -> IO () -- | Reset which apps are running. -- -- reloadAppList :: AppManager -> Map Appname (FilePath, EpochTime) -> IO () addApp :: AppManager -> FilePath -> IO () terminateApp :: AppManager -> Appname -> IO () initialize :: (LogMessage -> IO ()) -> AppStartConfig -> IO AppManager renderApps :: AppManager -> STM Text instance GHC.Show.Show Keter.AppManager.Action module Keter.Cli launchCli :: CliStates -> IO () data CliStates MkCliStates :: !AppManager -> !LogMessage -> IO () -> !Port -> CliStates [csAppManager] :: CliStates -> !AppManager [csLog] :: CliStates -> !LogMessage -> IO () [csPort] :: CliStates -> !Port -- | A light-weight, minimalistic reverse HTTP proxy. module Keter.Proxy reverseProxy :: Bool -> Int -> Manager -> HostLookup -> ListeningPort -> IO () -- | Mapping from virtual hostname to port number. type HostLookup = ByteString -> IO (Maybe (ProxyAction, Credentials)) data TLSConfig TLSConfig :: !Settings -> !FilePath -> !FilePath -> Maybe Config -> TLSConfig module Keter.Main keter :: FilePath -> [FilePath -> IO Plugin] -> IO ()