@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1@title Configuration User Guide: Advanced Configuration
2@group config
3
4Configuring Phorge for multiple environments.
5
6= Overview =
7
8Phorge reads configuration from multiple sources. This document explains
9the configuration stack and how to set up advanced configuration sources, which
10may be useful for deployments with multiple environments (e.g., development and
11production).
12
13This is a complicated topic for advanced users. You do not need to understand
14this topic to install Phorge.
15
16= Configuration Sources =
17
18Phorge supports the following configuration sources, from highest priority
19to lowest priority:
20
21 - **Database**: Values are stored in the database and edited from the web UI
22 by administrators. They have the highest priority and override other
23 settings.
24 - **Local Config**: Values are stored in `conf/local/local.json` and edited by
25 running `bin/config`.
26 - **File**: Values are stored in a config file in `conf/`. The file
27 to use is selected by writing to `conf/local/ENVIRONMENT`, or setting the
28 `PHABRICATOR_ENV` configuration variable. See below for more information.
29 - **Global Default**: Defaults hard-coded in the Phorge source, which can not
30 be edited. They have the lowest priority, and all other settings override
31 them.
32
33Normally, you install and configure Phorge by writing enough configuration
34into the local config to get access to the database configuration (e.g., the
35MySQL username, password, and hostname), then use the web interface to further
36configure Phorge.
37
38= Configuration Files =
39
40Configuration files provide an alternative to database configuration, and may be
41appropriate if you want to deploy in multiple environments or create dynamic
42configuration. Configuration files are more complicated than database
43configuration, which is why they are not used by default.
44
45== Creating a Configuration File ==
46
47To create a configuration file, first choose a name for the config (like
48"devserver" or "live"). For the purposes of this section, we'll assume you chose
49`exampleconfig`. Replace "exampleconfig" with whatever you actually chose in the
50examples below.
51
52First, write an `exampleconfig.conf.php` file here (rename it according to the
53name you chose):
54
55 phorge/conf/custom/exampleconfig.conf.php
56
57Its contents should look like this:
58
59 <?php
60
61 return array(
62 // Specify whichever keys and values you want to set.
63 'example.key' => 'examplevalue',
64 );
65
66For example, to specify MySQL credentials in your config file, you might create
67a config like this:
68
69 <?php
70
71 return array(
72 'mysql.host' => 'localhost',
73 'mysql.user' => 'root',
74 'mysql.pass' => 'hunter2trustno1',
75 );
76
77== Selecting a Configuration File ==
78
79To select a configuration file, write the name of the file (relative to
80`phorge/conf/`) to `phorge/conf/local/ENVIRONMENT`. For example, to
81select `phorge/conf/custom/exampleconfig.conf.php`, you would write
82"custom/exampleconfig" to `phorge/conf/local/ENVIRONMENT`:
83
84 phorge/ $ echo custom/exampleconfig > conf/local/ENVIRONMENT
85 phorge/ $ cat conf/local/ENVIRONMENT
86 custom/exampleconfig
87 phorge/ $
88
89You can also set the environmental variable `PHABRICATOR_ENV`. This is more
90involved but may be easier in some deployment environments. Note that this needs
91to be set in your webserver environment, and also in your shell whenever you
92run a script:
93
94```
95# Shell
96export PHABRICATOR_ENV=custom/exampleconfig
97
98# Apache
99SetEnv PHABRICATOR_ENV custom/exampleconfig
100
101# nginx
102fastcgi_param PHABRICATOR_ENV "custom/exampleconfig";
103
104# lighttpd
105setenv.add-environment = (
106 "PHABRICATOR_ENV" => "custom/exampleconfig",
107)
108```
109
110After creating and selecting a configuration file, restart Phorge (for
111help, see @{article:Restarting Phorge}). Any configuration you set should
112take effect immediately, and your file should be visible in the Config
113application when examining configuration.
114
115= Next Steps =
116
117Return to the @{article:Configuration Guide}.