-
Notifications
You must be signed in to change notification settings - Fork 0
/
castor.context.dist.php
50 lines (42 loc) · 1.1 KB
/
castor.context.dist.php
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
<?php
use Castor\Attribute\AsContext;
use Castor\Context;
use function Castor\load_dot_env;
#[AsContext(name: 'dev', default: false)]
function dev_context(): Context
{
$env = load_dot_env();
return new Context(
data: [
'in_builder' => isset($_SERVER['IN_BUILDER']) && '1' === $_SERVER['IN_BUILDER'],
] + COMMON_CONTEXT + $env,
environment: $_ENV + $_SERVER + [
'SYMFONY_DEPRECATIONS_HELPER' => 'disabled',
],
tty: true,
timeout: null
);
}
#[AsContext(name: 'prod', default: true)]
function prod_context(): Context
{
$env = load_dot_env();
return new Context(
data: [
'in_builder' => isset($_SERVER['IN_BUILDER']) && '1' === $_SERVER['IN_BUILDER'],
'app_env' => 'prod',
'user' => 'www-data',
] + COMMON_CONTEXT + $env,
environment: $_ENV + $_SERVER,
timeout: null
);
}
#[AsContext(name: 'backup', default: false)]
function backup_context(): Context
{
$prod = prod_context();
return $prod
->withTty(false)
->withPty(false)
;
}