Web Interfaces of PROSUME

app.php 16KB

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