mirror of
https://github.com/Start9Labs/registry.git
synced 2026-03-26 02:11:53 +00:00
reworked constants into configurable settings
This commit is contained in:
@@ -23,8 +23,9 @@ import Yesod.Core
|
||||
import Foundation
|
||||
import Lib.Registry
|
||||
import Lib.Semver
|
||||
import System.FilePath ((<.>))
|
||||
import System.FilePath ((<.>), (</>))
|
||||
import System.Posix.Files (fileSize, getFileStatus)
|
||||
import Settings
|
||||
|
||||
pureLog :: Show a => a -> Handler a
|
||||
pureLog = liftA2 (*>) ($logInfo . show) pure
|
||||
@@ -38,13 +39,22 @@ instance Show FileExtension where
|
||||
show (FileExtension f (Just e)) = f <.> e
|
||||
|
||||
getAppsManifestR :: Handler TypedContent
|
||||
getAppsManifestR = respondSource typePlain $ CB.sourceFile appManifestPath .| awaitForever sendChunkBS
|
||||
getAppsManifestR = do
|
||||
AppSettings{..} <- appSettings <$> getYesod
|
||||
let appResourceDir = resourcesDir </> "apps" </> "apps.yaml"
|
||||
respondSource typePlain $ CB.sourceFile appResourceDir .| awaitForever sendChunkBS
|
||||
|
||||
getSysR :: Extension "" -> Handler TypedContent
|
||||
getSysR = getApp sysResourceDir
|
||||
getSysR e = do
|
||||
AppSettings{..} <- appSettings <$> getYesod
|
||||
let sysResourceDir = resourcesDir </> "sys"
|
||||
getApp sysResourceDir e
|
||||
|
||||
getAppR :: Extension "s9pk" -> Handler TypedContent
|
||||
getAppR = getApp appResourceDir
|
||||
getAppR e = do
|
||||
AppSettings{..} <- appSettings <$> getYesod
|
||||
let appResourceDir = resourcesDir </> "apps" </> "apps.yaml"
|
||||
getApp appResourceDir e
|
||||
|
||||
getApp :: KnownSymbol a => FilePath -> Extension a -> Handler TypedContent
|
||||
getApp rootDir ext = do
|
||||
|
||||
Reference in New Issue
Block a user