-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathEnv.hs
More file actions
62 lines (60 loc) · 2.27 KB
/
Env.hs
File metadata and controls
62 lines (60 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
module Share.Env
( Env (..),
)
where
import Crypto.JOSE.JWK qualified as JWK
import Database.Redis qualified as R
import Hasql.Pool qualified as Hasql
import Network.HTTP.Client qualified as HTTPClient
import Network.URI (URI)
import Servant.Client qualified as S
import Share.JWT qualified as JWT
import Share.Prelude
import Share.Utils.Logging.Types qualified as Logging
import Share.Utils.Servant.Cookies qualified as Cookies
import System.Log.FastLogger (FormattedTime, LogStr)
import System.Log.Raven.Types (SentryService)
import Unison.Codebase.Runtime (Runtime)
import Unison.Symbol (Symbol)
import Vault qualified
data Env ctx = Env
{ redisConnection :: R.Connection,
pgConnectionPool :: Hasql.Pool,
logger :: LogStr -> IO (),
timeCache :: IO FormattedTime,
minLogSeverity :: Logging.Severity,
-- Config
apiOrigin :: URI, -- E.g. "https://api.unison-lang.org"
shareUiOrigin :: URI, -- E.g. "https://share.unison-lang.org"
websiteOrigin :: URI, -- E.g. "https://www.unison-lang.org"
cloudUiOrigin :: URI, -- E.g. "https://app.unison.cloud"
cloudWebsiteOrigin :: URI, -- E.g. "https://www.unison.cloud"
supportTicketWebhookURI :: Maybe URI,
vaultClientEnv :: S.ClientEnv,
userSecretsVaultMount :: Vault.SecretMount,
shareVaultToken :: Vault.VaultToken,
-- An HTTP client for making requests which are configured by end users, and thus
-- shouldn't
proxiedHttpClient :: HTTPClient.Manager,
serverPort :: Int,
redisConfig :: R.ConnectInfo,
postgresConfig :: Text,
githubClientID :: Text,
githubClientSecret :: Text,
jwtSettings :: JWT.JWTSettings,
hashJWTJWK :: JWK.JWK,
cookieSettings :: Cookies.CookieSettings,
sessionCookieKey :: Text,
sandboxedRuntime :: Runtime Symbol,
sentryService :: SentryService,
-- The commit hash of the currently running version of Share
commitHash :: Text,
ctx :: ctx,
shouldCheckForMigration :: Bool,
-- The maximum number of workers to use for concurrent work on a single request.
-- E.g. sync can parallelize signing/verifying JWTs or run multiple transactions against
-- PG. If this goes too high we can end up tanking Share.
maxParallelismPerDownloadRequest :: Int,
maxParallelismPerUploadRequest :: Int
}
deriving (Functor)