app.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. <?php
  2. use Cake\Cache\Engine\FileEngine;
  3. use Cake\Database\Connection;
  4. use Cake\Database\Driver\Mysql;
  5. use Cake\Log\Engine\FileLog;
  6. use Cake\Mailer\Transport\MailTransport;
  7. return [
  8. /*
  9. * Debug Level:
  10. *
  11. * Production Mode:
  12. * false: No error messages, errors, or warnings shown.
  13. *
  14. * Development Mode:
  15. * true: Errors and warnings shown.
  16. */
  17. 'debug' => false, //filter_var(env('DEBUG', false), FILTER_VALIDATE_BOOLEAN),
  18. /*
  19. * Configure basic information about the application.
  20. *
  21. * - namespace - The namespace to find app classes under.
  22. * - defaultLocale - The default locale for translation, formatting currencies and numbers, date and time.
  23. * - encoding - The encoding used for HTML + database connections.
  24. * - base - The base directory the app resides in. If false this
  25. * will be auto detected.
  26. * - dir - Name of app directory.
  27. * - webroot - The webroot directory.
  28. * - wwwRoot - The file path to webroot.
  29. * - baseUrl - To configure CakePHP to *not* use mod_rewrite and to
  30. * use CakePHP pretty URLs, remove these .htaccess
  31. * files:
  32. * /.htaccess
  33. * /webroot/.htaccess
  34. * And uncomment the baseUrl key below.
  35. * - fullBaseUrl - A base URL to use for absolute links. When set to false (default)
  36. * CakePHP generates required value based on `HTTP_HOST` environment variable.
  37. * However, you can define it manually to optimize performance or if you
  38. * are concerned about people manipulating the `Host` header.
  39. * - imageBaseUrl - Web path to the public images directory under webroot.
  40. * - cssBaseUrl - Web path to the public css directory under webroot.
  41. * - jsBaseUrl - Web path to the public js directory under webroot.
  42. * - paths - Configure paths for non class based resources. Supports the
  43. * `plugins`, `templates`, `locales` subkeys, which allow the definition of
  44. * paths for plugins, view templates and locale files respectively.
  45. */
  46. 'App' => [
  47. 'namespace' => 'App',
  48. 'encoding' => env('APP_ENCODING', 'UTF-8'),
  49. 'defaultLocale' => env('APP_DEFAULT_LOCALE', 'en_US'),
  50. 'defaultTimezone' => env('APP_DEFAULT_TIMEZONE', 'UTC'),
  51. 'base' => false,
  52. 'dir' => 'src',
  53. 'webroot' => 'webroot',
  54. 'wwwRoot' => WWW_ROOT,
  55. //'baseUrl' => env('SCRIPT_NAME'),
  56. 'fullBaseUrl' => false,
  57. 'imageBaseUrl' => 'img/',
  58. 'cssBaseUrl' => 'css/',
  59. 'jsBaseUrl' => 'js/',
  60. 'paths' => [
  61. 'plugins' => [ROOT . DS . 'plugins' . DS],
  62. 'templates' => [ROOT . DS . 'templates' . DS],
  63. 'locales' => [RESOURCES . 'locales' . DS],
  64. ],
  65. ],
  66. /*
  67. * Security and encryption configuration
  68. *
  69. * - salt - A random string used in security hashing methods.
  70. * The salt value is also used as the encryption key.
  71. * You should treat it as extremely sensitive data.
  72. */
  73. 'Security' => [
  74. 'salt' => env('SECURITY_SALT', '3ff7e038084e5f048329ff059595581b5dbcfef5c9d7b0ede105382539a41f84'),
  75. ],
  76. /*
  77. * Apply timestamps with the last modified time to static assets (js, css, images).
  78. * Will append a querystring parameter containing the time the file was modified.
  79. * This is useful for busting browser caches.
  80. *
  81. * Set to true to apply timestamps when debug is true. Set to 'force' to always
  82. * enable timestamping regardless of debug value.
  83. */
  84. 'Asset' => [
  85. //'timestamp' => true,
  86. // 'cacheTime' => '+1 year'
  87. ],
  88. /*
  89. * Configure the cache adapters.
  90. */
  91. 'Cache' => [
  92. 'default' => [
  93. 'className' => FileEngine::class,
  94. 'path' => CACHE,
  95. 'url' => env('CACHE_DEFAULT_URL', null),
  96. ],
  97. /*
  98. * Configure the cache used for general framework caching.
  99. * Translation cache files are stored with this configuration.
  100. * Duration will be set to '+2 minutes' in bootstrap.php when debug = true
  101. * If you set 'className' => 'Null' core cache will be disabled.
  102. */
  103. '_cake_core_' => [
  104. 'className' => FileEngine::class,
  105. 'prefix' => 'myapp_cake_core_',
  106. 'path' => CACHE . 'persistent' . DS,
  107. 'serialize' => true,
  108. 'duration' => '+1 years',
  109. 'url' => env('CACHE_CAKECORE_URL', null),
  110. ],
  111. /*
  112. * Configure the cache for model and datasource caches. This cache
  113. * configuration is used to store schema descriptions, and table listings
  114. * in connections.
  115. * Duration will be set to '+2 minutes' in bootstrap.php when debug = true
  116. */
  117. '_cake_model_' => [
  118. 'className' => FileEngine::class,
  119. 'prefix' => 'myapp_cake_model_',
  120. 'path' => CACHE . 'models' . DS,
  121. 'serialize' => true,
  122. 'duration' => '+1 years',
  123. 'url' => env('CACHE_CAKEMODEL_URL', null),
  124. ],
  125. ],
  126. /*
  127. * Configure the Error and Exception handlers used by your application.
  128. *
  129. * By default errors are displayed using Debugger, when debug is true and logged
  130. * by Cake\Log\Log when debug is false.
  131. *
  132. * In CLI environments exceptions will be printed to stderr with a backtrace.
  133. * In web environments an HTML page will be displayed for the exception.
  134. * With debug true, framework errors like Missing Controller will be displayed.
  135. * When debug is false, framework errors will be coerced into generic HTTP errors.
  136. *
  137. * Options:
  138. *
  139. * - `errorLevel` - int - The level of errors you are interested in capturing.
  140. * - `trace` - boolean - Whether backtraces should be included in
  141. * logged errors/exceptions.
  142. * - `log` - boolean - Whether you want exceptions logged.
  143. * - `exceptionRenderer` - string - The class responsible for rendering uncaught exceptions.
  144. * The chosen class will be used for both CLI and web environments. If you want different
  145. * classes used in CLI and web environments you'll need to write that conditional logic as well.
  146. * The conventional location for custom renderers is in `src/Error`. Your exception renderer needs to
  147. * implement the `render()` method and return either a string or Http\Response.
  148. * `errorRenderer` - string - The class responsible for rendering PHP errors. The selected
  149. * class will be used for both web and CLI contexts. If you want different classes for each environment
  150. * you'll need to write that conditional logic as well. Error renderers need to
  151. * to implement the `Cake\Error\ErrorRendererInterface`.
  152. * - `skipLog` - array - List of exceptions to skip for logging. Exceptions that
  153. * extend one of the listed exceptions will also be skipped for logging.
  154. * E.g.:
  155. * `'skipLog' => ['Cake\Http\Exception\NotFoundException', 'Cake\Http\Exception\UnauthorizedException']`
  156. * - `extraFatalErrorMemory` - int - The number of megabytes to increase the memory limit by
  157. * when a fatal error is encountered. This allows
  158. * breathing room to complete logging or error handling.
  159. * - `ignoredDeprecationPaths` - array - A list of glob compatible file paths that deprecations
  160. * should be ignored in. Use this to ignore deprecations for plugins or parts of
  161. * your application that still emit deprecations.
  162. */
  163. 'Error' => [
  164. 'errorLevel' => E_ALL,
  165. 'skipLog' => [],
  166. 'log' => false,
  167. 'trace' => true,
  168. 'ignoredDeprecationPaths' => [],
  169. ],
  170. /*
  171. * Debugger configuration
  172. *
  173. * Define development error values for Cake\Error\Debugger
  174. *
  175. * - `editor` Set the editor URL format you want to use.
  176. * By default atom, emacs, macvim, phpstorm, sublime, textmate, and vscode are
  177. * available. You can add additional editor link formats using
  178. * `Debugger::addEditor()` during your application bootstrap.
  179. * - `outputMask` A mapping of `key` to `replacement` values that
  180. * `Debugger` should replace in dumped data and logs generated by `Debugger`.
  181. */
  182. 'Debugger' => [
  183. 'editor' => 'phpstorm',
  184. ],
  185. /*
  186. * Email configuration.
  187. *
  188. * By defining transports separately from delivery profiles you can easily
  189. * re-use transport configuration across multiple profiles.
  190. *
  191. * You can specify multiple configurations for production, development and
  192. * testing.
  193. *
  194. * Each transport needs a `className`. Valid options are as follows:
  195. *
  196. * Mail - Send using PHP mail function
  197. * Smtp - Send using SMTP
  198. * Debug - Do not send the email, just return the result
  199. *
  200. * You can add custom transports (or override existing transports) by adding the
  201. * appropriate file to src/Mailer/Transport. Transports should be named
  202. * 'YourTransport.php', where 'Your' is the name of the transport.
  203. */
  204. 'EmailTransport' => [
  205. 'default' => [
  206. 'className' => MailTransport::class,
  207. /*
  208. * The keys host, port, timeout, username, password, client and tls
  209. * are used in SMTP transports
  210. */
  211. 'host' => 'localhost',
  212. 'port' => 25,
  213. 'timeout' => 30,
  214. /*
  215. * It is recommended to set these options through your environment or app_local.php
  216. */
  217. //'username' => null,
  218. //'password' => null,
  219. 'client' => null,
  220. 'tls' => false,
  221. 'url' => env('EMAIL_TRANSPORT_DEFAULT_URL', null),
  222. ],
  223. ],
  224. /*
  225. * Email delivery profiles
  226. *
  227. * Delivery profiles allow you to predefine various properties about email
  228. * messages from your application and give the settings a name. This saves
  229. * duplication across your application and makes maintenance and development
  230. * easier. Each profile accepts a number of keys. See `Cake\Mailer\Email`
  231. * for more information.
  232. */
  233. 'Email' => [
  234. 'default' => [
  235. 'transport' => 'default',
  236. 'from' => 'you@localhost',
  237. /*
  238. * Will by default be set to config value of App.encoding, if that exists otherwise to UTF-8.
  239. */
  240. //'charset' => 'utf-8',
  241. //'headerCharset' => 'utf-8',
  242. ],
  243. ],
  244. /*
  245. * Connection information used by the ORM to connect
  246. * to your application's datastores.
  247. *
  248. * ### Notes
  249. * - Drivers include Mysql Postgres Sqlite Sqlserver
  250. * See vendor\cakephp\cakephp\src\Database\Driver for complete list
  251. * - Do not use periods in database name - it may lead to error.
  252. * See https://github.com/cakephp/cakephp/issues/6471 for details.
  253. * - 'encoding' is recommended to be set to full UTF-8 4-Byte support.
  254. * E.g set it to 'utf8mb4' in MariaDB and MySQL and 'utf8' for any
  255. * other RDBMS.
  256. */
  257. 'Datasources' => [
  258. /*
  259. * These configurations should contain permanent settings used
  260. * by all environments.
  261. *
  262. * The values in app_local.php will override any values set here
  263. * and should be used for local and per-environment configurations.
  264. *
  265. * Environment variable based configurations can be loaded here or
  266. * in app_local.php depending on the applications needs.
  267. */
  268. 'default' => [
  269. 'className' => Connection::class,
  270. 'driver' => Mysql::class,
  271. 'persistent' => true,
  272. 'timezone' => 'UTC',
  273. 'host' => 'tfb-database',
  274. /*
  275. * CakePHP will use the default DB port based on the driver selected
  276. * MySQL on MAMP uses port 8889, MAMP users will want to uncomment
  277. * the following line and set the port accordingly
  278. */
  279. //'port' => '3306',
  280. 'username' => 'benchmarkdbuser',
  281. 'password' => 'benchmarkdbpass',
  282. 'database' => 'hello_world',
  283. /*
  284. * You do not need to set this flag to use full utf-8 encoding (internal default since CakePHP 3.6).
  285. */
  286. //'encoding' => 'utf8mb4',
  287. 'timezone' => 'UTC',
  288. 'flags' => [],
  289. 'cacheMetadata' => true,
  290. 'log' => false,
  291. /*
  292. * If not using the default 'public' schema with the PostgreSQL driver
  293. * set it here.
  294. */
  295. //'schema' => 'myapp',
  296. /*
  297. * You can use a DSN string to set the entire configuration
  298. */
  299. //'url' => env('DATABASE_URL', null),
  300. ],
  301. /*
  302. * The test connection is used during the test suite.
  303. */
  304. // 'test' => [
  305. // 'className' => Connection::class,
  306. // 'driver' => Mysql::class,
  307. // 'persistent' => false,
  308. // 'timezone' => 'UTC',
  309. // //'encoding' => 'utf8mb4',
  310. // 'flags' => [],
  311. // 'cacheMetadata' => true,
  312. // 'quoteIdentifiers' => false,
  313. // 'log' => false,
  314. // //'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
  315. // ],
  316. ],
  317. /*
  318. * Configures logging options
  319. */
  320. 'Log' => [
  321. 'debug' => [
  322. 'className' => FileLog::class,
  323. 'path' => LOGS,
  324. 'file' => 'debug',
  325. 'url' => env('LOG_DEBUG_URL', null),
  326. 'scopes' => null,
  327. 'levels' => ['notice', 'info', 'debug'],
  328. ],
  329. 'error' => [
  330. 'className' => FileLog::class,
  331. 'path' => LOGS,
  332. 'file' => 'error',
  333. 'url' => env('LOG_ERROR_URL', null),
  334. 'scopes' => null,
  335. 'levels' => ['warning', 'error', 'critical', 'alert', 'emergency'],
  336. ],
  337. // To enable this dedicated query log, you need set your datasource's log flag to true
  338. 'queries' => [
  339. 'className' => FileLog::class,
  340. 'path' => LOGS,
  341. 'file' => 'queries',
  342. 'url' => env('LOG_QUERIES_URL', null),
  343. 'scopes' => ['cake.database.queries'],
  344. ],
  345. ],
  346. /*
  347. * Session configuration.
  348. *
  349. * Contains an array of settings to use for session configuration. The
  350. * `defaults` key is used to define a default preset to use for sessions, any
  351. * settings declared here will override the settings of the default config.
  352. *
  353. * ## Options
  354. *
  355. * - `cookie` - The name of the cookie to use. Defaults to value set for `session.name` php.ini config.
  356. * Avoid using `.` in cookie names, as PHP will drop sessions from cookies with `.` in the name.
  357. * - `cookiePath` - The url path for which session cookie is set. Maps to the
  358. * `session.cookie_path` php.ini config. Defaults to base path of app.
  359. * - `timeout` - The time in minutes the session should be valid for.
  360. * Pass 0 to disable checking timeout.
  361. * Please note that php.ini's session.gc_maxlifetime must be equal to or greater
  362. * than the largest Session['timeout'] in all served websites for it to have the
  363. * desired effect.
  364. * - `defaults` - The default configuration set to use as a basis for your session.
  365. * There are four built-in options: php, cake, cache, database.
  366. * - `handler` - Can be used to enable a custom session handler. Expects an
  367. * array with at least the `engine` key, being the name of the Session engine
  368. * class to use for managing the session. CakePHP bundles the `CacheSession`
  369. * and `DatabaseSession` engines.
  370. * - `ini` - An associative array of additional 'session.*` ini values to set.
  371. *
  372. * The built-in `defaults` options are:
  373. *
  374. * - 'php' - Uses settings defined in your php.ini.
  375. * - 'cake' - Saves session files in CakePHP's /tmp directory.
  376. * - 'database' - Uses CakePHP's database sessions.
  377. * - 'cache' - Use the Cache class to save sessions.
  378. *
  379. * To define a custom session handler, save it at src/Http/Session/<name>.php.
  380. * Make sure the class implements PHP's `SessionHandlerInterface` and set
  381. * Session.handler to <name>
  382. *
  383. * To use database sessions, load the SQL file located at config/schema/sessions.sql
  384. */
  385. 'Session' => [
  386. 'defaults' => 'php',
  387. ],
  388. ];