File tree Expand file tree Collapse file tree 2 files changed +36
-2
lines changed
user_guide_src/source/database Expand file tree Collapse file tree 2 files changed +36
-2
lines changed Original file line number Diff line number Diff line change @@ -104,8 +104,19 @@ default group's configuration settings. The values should be name following this
104104 database.default.password = '';
105105 database.default.database = 'ci4';
106106
107- .. important :: You cannot add a new property by setting environment variables,
108- nor change a scalar value to an array. See :ref: `env-var-replacements-for-data `.
107+ But you cannot add a new property by setting environment variables, nor change a
108+ scalar value to an array. See :ref: `env-var-replacements-for-data ` for details.
109+
110+ So if you want to use SSL with MySQL, you need a hack. For example, set the array
111+ values as a JSON string in your **.env ** file:
112+
113+ ::
114+
115+ database.default.encrypt = {"ssl_verify":true,"ssl_ca":"/var/www/html/BaltimoreCyberTrustRoot.crt.pem"}
116+
117+ and decode it in the constructor in the Config class:
118+
119+ .. literalinclude :: configuration/009.php
109120
110121**********************
111122Explanation of Values:
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Config ;
4+
5+ use CodeIgniter \Database \Config ;
6+
7+ /**
8+ * Database Configuration
9+ */
10+ class Database extends Config
11+ {
12+ // ...
13+
14+ public function __construct ()
15+ {
16+ // ...
17+
18+ $ array = json_decode ($ this ->default ['encrypt ' ], true );
19+ if (is_array ($ array )) {
20+ $ this ->default ['encrypt ' ] = $ array ;
21+ }
22+ }
23+ }
You can’t perform that action at this time.
0 commit comments