You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+71-14Lines changed: 71 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,22 +1,39 @@
1
1
Configurator
2
2
============
3
3
4
-
Generates config files from PHP based templates and PHP style config files.
4
+
A few simple tools to manage configuration data sanely. These tools are to hold environment data that can be shared without risk. They are not designed to hold 'secrets' e.g. api/oauth keys.
5
5
6
+
* Config file generator
6
7
8
+
* Environment settings
7
9
8
-
## Generate config files
10
+
* Convert PHP ini files to PHP-FPM format
9
11
12
+
## Config file generator
10
13
11
-
Source config file
14
+
This tool allows you to generate config files from PHP based templates and PHP data files that hold all of the setting for the different environments
-p - a comma separated list of PHP data files. Each need to return an array of data.
72
+
-j - a comma separated list of JSON data files.
73
+
input - the input template file.
74
+
output - the output file to write.
75
+
environment - a comma separated list of environment settings to apply.
76
+
51
77
52
78
53
79
## Generate environment settings
54
80
81
+
A tool that will parse the environment settings required by an application, and the data files that hold the settings for all environments, and will generated a file that contains a function that returns an array of what env settings are required by this application
55
82
56
83
57
-
A file that returns an array of what env settings are required by this application
84
+
File listing the environment settings required by the application:
58
85
59
86
```
60
87
<?php
61
88
62
-
use ImagickDemo\Config;
89
+
use ExampleApp\AppConfig;
63
90
64
91
$env = [
65
-
Config::CACHING_SETTING,
66
-
Config::SCRIPT_PACKING,
92
+
AppConfig::CACHING_SETTING,
93
+
AppConfig::SCRIPT_PACKING,
94
+
AppConfig::FILE_STORAGE
67
95
];
68
96
69
97
return $env;
70
98
```
71
99
100
+
A data file that holds all the data for the various environment settings
101
+
102
+
```
103
+
$dev = [
104
+
AppConfig::SCRIPT_PACKING => true,
105
+
AppConfig::CACHING_SETTING => 'caching.disable',
106
+
];
107
+
108
+
$live = [
109
+
AppConfig::SCRIPT_PACKING => true,
110
+
AppConfig::CACHING_SETTING => 'caching.time'
111
+
];
112
+
113
+
114
+
// Anyone doing UX testing needs to have the scripts packed together
115
+
// to avoid slow UI responses
116
+
$uxtesting[AppConfig::SCRIPT_PACKING] = true;
117
+
```
118
+
119
+
Running the command `bin/genenv -p environment/config.php environment/envRequired.php env.php dev,uxtesting`
72
120
73
121
Produces a file containing a single function that contains all the requested env settings.
74
122
@@ -78,7 +126,7 @@ Produces a file containing a single function that contains all the requested env
78
126
function getAppEnv() {
79
127
static $env = [
80
128
'caching.setting' => 'caching.revalidate',
81
-
'script.packing' => '',
129
+
'script.packing' => 'true',
82
130
];
83
131
84
132
return $env;
@@ -89,22 +137,31 @@ function getAppEnv() {
89
137
The keys are the actual strings, rather than the constants used in the application, to allow the settings to be used outside of the application.
-p - a comma separated list of PHP data files. Each need to return an array of data.
145
+
-j - a comma separated list of JSON data files.
146
+
input - the input template file.
147
+
output - the output file to write.
148
+
environment - a comma separated list of environment settings to apply.
94
149
95
150
## Convert PHP ini files to PHP-FPM format
96
151
97
-
Because of reasons, PHP-FPM doesn't use the standard PHP in file format when including ini files in a pool in the PHP-FPM conf file.
152
+
Because of reasons, PHP-FPM doesn't use the standard PHP in file format when including ini files in a pool in the PHP-FPM conf file. This aspect of the Configurator converts PHP style ini files to the format PHP-FPM expects:
98
153
99
-
This aspect of the Configurator converts PHP style ini files:
154
+
Input ini file:
100
155
101
156
```
102
157
extension=imagick.so
103
158
default_charset = "utf-8";
104
159
post_max_size = 10M
105
160
```
106
161
107
-
to PHP-FPM style files:
162
+
Running the command `php bin/fpmconv example.php.ini example.phpfpm.ini`
0 commit comments