Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there) https://friendi.ca
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Config.md 8.0KB

1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. Config values that can only be set in config/local.config.php
  2. ==========================================================
  3. * [Home](help)
  4. Friendica's configuration is done in two places: in PHP array configuration files and in the `config` database table.
  5. Database config values overwrite the same file config values.
  6. ## File configuration
  7. The configuration format for file configuration is an array returned from a PHP file.
  8. This prevents your webserver from displaying your private configuration. It interprets the configuration files and displays nothing.
  9. A typical configuration file looks like this:
  10. ```php
  11. <?php
  12. /*
  13. * Comment block
  14. */
  15. return [
  16. 'section1' => [
  17. // Comment line
  18. 'key' => 'value',
  19. ],
  20. 'section2' => [
  21. 'array' => ['value0', 'value1', 'value2'],
  22. ],
  23. ];
  24. ```
  25. ### Configuration location
  26. The `config` directory holds key configuration files:
  27. - `defaults.config.php` holds the default values for all the configuration keys that can only be set in `local.config.php`.
  28. - `settings.config.php` holds the default values for some configuration keys that are set through the admin settings page.
  29. - `local.config.php` holds the current node custom configuration.
  30. - `addon.config.php` is optional and holds the custom configuration for specific addons.
  31. Addons can define their own default configuration values in `addon/[addon]/config/[addon].config.php` which is loaded when the addon is activated.
  32. #### Migrating from .htconfig.php to config/local.config.php
  33. The legacy `.htconfig.php` configuration file is still supported, but is deprecated and will be removed in a subsequent Friendica release.
  34. The migration is pretty straightforward:
  35. If you had any addon-specific configuration in your `.htconfig.php`, just copy `config/addon-sample.config.php` to `config/addon.config.php` and move your configuration values.
  36. Afterwards, copy `config/local-sample.config.php` to `config/local.config.php`, move the remaining configuration values to it according to the following conversion chart, then rename your `.htconfig.php` to check your node is working as expected before deleting it.
  37. <style>
  38. table.config {
  39. margin: 1em 0;
  40. background-color: #f9f9f9;
  41. border: 1px solid #aaa;
  42. border-collapse: collapse;
  43. color: #000;
  44. width: 100%;
  45. }
  46. table.config > tr > th,
  47. table.config > tr > td,
  48. table.config > * > tr > th,
  49. table.config > * > tr > td {
  50. border: 1px solid #aaa;
  51. padding: 0.2em 0.4em
  52. }
  53. table.config > tr > th,
  54. table.config > * > tr > th {
  55. background-color: #f2f2f2;
  56. text-align: center;
  57. width: 50%
  58. }
  59. </style>
  60. <table class="config">
  61. <thead>
  62. <tr>
  63. <th>.htconfig.php</th>
  64. <th>config/local.config.php</th>
  65. </tr>
  66. </thead>
  67. <tbody>
  68. <tr>
  69. <td><pre>
  70. $db_host = 'localhost';
  71. $db_user = 'mysqlusername';
  72. $db_pass = 'mysqlpassword';
  73. $db_data = 'mysqldatabasename';
  74. $a->config["system"]["db_charset"] = 'utf8mb4';
  75. </pre></td>
  76. <td><pre>
  77. 'database' => [
  78. 'hostname' => 'localhost',
  79. 'username' => 'mysqlusername',
  80. 'password' => 'mysqlpassword',
  81. 'database' => 'database',
  82. 'charset' => 'utf8mb4',
  83. ],
  84. </pre></td>
  85. </tr>
  86. <tr>
  87. <td><pre>
  88. $a->config["section"]["key"] = "value";
  89. </pre></td>
  90. <td><pre>
  91. 'section' => [
  92. 'key' => 'value',
  93. ],
  94. </pre></td>
  95. </tr>
  96. <tr>
  97. <td><pre>
  98. $a->config["section"]["key"] = array(
  99. "value1",
  100. "value2",
  101. "value3"
  102. );
  103. </pre></td>
  104. <td><pre>
  105. 'section' => [
  106. 'key' => ['value1', 'value2', 'value3'],
  107. ],
  108. </pre></td>
  109. </tr>
  110. <tr>
  111. <td><pre>
  112. $a->config["key"] = "value";
  113. </pre></td>
  114. <td><pre>
  115. 'config' => [
  116. 'key' => 'value',
  117. ],
  118. </pre></td>
  119. </tr>
  120. <tr>
  121. <td><pre>
  122. $a->config['register_policy'] = REGISTER_CLOSED;
  123. </pre></td>
  124. <td><pre>
  125. 'config' => [
  126. 'register_policy' => \Friendica\Module\Register::CLOSED,
  127. ],
  128. </pre></td>
  129. </tr>
  130. <tr>
  131. <td><pre>
  132. $a->path = "value";
  133. </pre></td>
  134. <td><pre>
  135. 'system' => [
  136. 'urlpath' => 'value',
  137. ],
  138. </pre></td>
  139. </tr>
  140. <tr>
  141. <td><pre>
  142. $default_timezone = "value";
  143. </pre></td>
  144. <td><pre>
  145. 'system' => [
  146. 'default_timezone' => 'value',
  147. ],
  148. </pre></td>
  149. </tr>
  150. <tr>
  151. <td><pre>
  152. $pidfile = "value";
  153. </pre></td>
  154. <td><pre>
  155. 'system' => [
  156. 'pidfile' => 'value',
  157. ],
  158. </pre></td>
  159. </tr>
  160. <tr>
  161. <td><pre>
  162. $lang = "value";
  163. </pre></td>
  164. <td><pre>
  165. 'system' => [
  166. 'language' => 'value',
  167. ],
  168. </pre></td>
  169. </tr>
  170. </tbody>
  171. </table>
  172. #### Migrating from config/local.ini.php to config/local.config.php
  173. The legacy `config/local.ini.php` configuration file is still supported, but is deprecated and will be removed in a subsequent Friendica release.
  174. The migration is pretty straightforward:
  175. If you had any addon-specific configuration in your `config/addon.ini.php`, just copy `config/addon-sample.config.php` to `config/addon.config.php` and move your configuration values.
  176. Afterwards, copy `config/local-sample.config.php` to `config/local.config.php`, move the remaining configuration values to it according to the following conversion chart, then rename your `config/local.ini.php` file to check your node is working as expected before deleting it.
  177. <table class="config">
  178. <thead>
  179. <tr>
  180. <th>config/local.ini.php</th>
  181. <th>config/local.config.php</th>
  182. </tr>
  183. </thead>
  184. <tbody>
  185. <tr>
  186. <td><pre>
  187. [database]
  188. hostname = localhost
  189. username = mysqlusername
  190. password = mysqlpassword
  191. database = mysqldatabasename
  192. charset = utf8mb4
  193. </pre></td>
  194. <td><pre>
  195. 'database' => [
  196. 'hostname' => 'localhost',
  197. 'username' => 'mysqlusername',
  198. 'password' => 'mysqlpassword',
  199. 'database' => 'database',
  200. 'charset' => 'utf8mb4',
  201. ],
  202. </pre></td>
  203. </tr>
  204. <tr>
  205. <td><pre>
  206. [section]
  207. key = value
  208. </pre></td>
  209. <td><pre>
  210. 'section' => [
  211. 'key' => 'value',
  212. ],
  213. </pre></td>
  214. </tr>
  215. <tr>
  216. <td><pre>
  217. [config]
  218. register_policty = REGISTER_CLOSED
  219. </pre></td>
  220. <td><pre>
  221. 'config' => [
  222. 'register_policy' => \Friendica\Module\Register::CLOSED,
  223. ],
  224. </pre></td>
  225. </tr>
  226. <tr>
  227. <td><pre>
  228. [section]
  229. key[] = value1
  230. key[] = value2
  231. key[] = value3
  232. </pre></td>
  233. <td><pre>
  234. 'section' => [
  235. 'key' => ['value1', 'value2', 'value3'],
  236. ],
  237. </pre></td>
  238. </tr>
  239. </tbody>
  240. </table>
  241. ### Database Settings
  242. The configuration variables database.hostname, database.username, database.password, database.database and database.charset are holding your credentials for the database connection.
  243. If you need to specify a port to access the database, you can do so by appending ":portnumber" to the database.hostname variable.
  244. 'database' => [
  245. 'hostname' => 'your.mysqlhost.com:123456',
  246. ]
  247. If all of the following environment variables are set, Friendica will use them instead of the previously configured variables for the db:
  248. MYSQL_HOST
  249. MYSQL_PORT
  250. MYSQL_USERNAME
  251. MYSQL_PASSWORD
  252. MYSQL_DATABASE
  253. ## Config values that can only be set in config/local.config.php
  254. There are some config values that haven't found their way into the administration page.
  255. This has several reasons.
  256. Maybe they are part of a current development that isn't considered stable and will be added later in the administration page when it is considered safe.
  257. Or it triggers something that isn't expected to be of public interest.
  258. Or it is for testing purposes only.
  259. **Attention:** Please be warned that you shouldn't use one of these values without the knowledge what it could trigger.
  260. Especially don't do that with undocumented values.
  261. These configurations keys and their default value are listed in `config/defaults.config.php` and should be overwritten in `config/local.config.php`.
  262. ## Administrator Options
  263. Enabling the admin panel for an account, and thus making the account holder admin of the node, is done by setting the variable
  264. 'config' => [
  265. 'admin_email' => 'someone@example.com',
  266. ]
  267. Where you have to match the email address used for the account with the one you enter to the `config/local.config.php` file.
  268. If more then one account should be able to access the admin panel, separate the email addresses with a comma.
  269. 'config' => [
  270. 'admin_email' => 'someone@example.com,someoneelse@example.com',
  271. ]
  272. If you want to have a more personalized closing line for the notification emails you can set a variable for the `admin_name`.
  273. 'config' => [
  274. 'admin_name' => 'Marvin',
  275. ]