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
The benefits of using a env.yaml file or similar has been proven a long time ago.
12
+
The benefits of using a env.yml file or similar has been proven a long time ago.
13
13
The popularity of [vlucas/phpdotenv](https://github.com/vlucas/phpdotenv) and
14
14
similar packages is a testament of this.
15
15
There is no reason why you shouldn't use a package like that in your projects,
@@ -19,7 +19,7 @@ In case of larger, enterprise scale, applications, the amount of environment
19
19
settings might very quickly become unmanageable. If it's a multi tenant system een more so. And if you're supporting different versions of the application with it's own list of required environment settings, it soon becomes a necessity to automate this process.
20
20
21
21
These are largely the reasons we decided to move towards Yaml. It provides
22
-
a few simple advantages over env.yaml files:
22
+
a few simple advantages over env.yml files:
23
23
* It allows nesting, to allow grouping of certain settings ( like database
24
24
connection credentials ).
25
25
* It is easily readable by human as well as multiple automated deployment
@@ -46,30 +46,30 @@ great base to work from!
46
46
47
47
Of course there are a few things unique to Yamlenv, and that has been added as well.
48
48
49
-
The `env.yaml` file is generally kept out of version control since it can contain
50
-
sensitive API keys and passwords. A separate `env.yaml.dist` file can be created
49
+
The `env.yml` file is generally kept out of version control since it can contain
50
+
sensitive API keys and passwords. A separate `env.yml.dist` file can be created
51
51
with all the required environment variables defined except for the sensitive
52
52
ones, which are either user-supplied for their own development environments or
53
53
are communicated elsewhere to project collaborators. The project collaborators
54
-
then independently copy the `env.yaml.dist` file to a local `env.yaml` and ensure
54
+
then independently copy the `env.yml.dist` file to a local `env.yml` and ensure
55
55
all the settings are correct for their local environment, filling in the secret
56
-
keys or providing their own values when necessary. In this usage, the `env.yaml`
56
+
keys or providing their own values when necessary. In this usage, the `env.yml`
57
57
file should be added to the project's `.gitignore` file so that it will never
58
58
be committed by collaborators. This usage ensures that no sensitive passwords
59
59
or API keys will ever be in the version control history so there is less risk
60
60
of a security breach, and production values will never have to be shared with
61
61
all project collaborators.
62
62
63
-
Add your application configuration to a `env.yaml` file in the root of your
64
-
project. **Make sure the `env.yaml` file is added to your `.gitignore` so it is not
63
+
Add your application configuration to a `env.yml` file in the root of your
64
+
project. **Make sure the `env.yml` file is added to your `.gitignore` so it is not
65
65
checked-in the code**
66
66
67
67
```shell
68
68
S3_BUCKET: "yamlenv"
69
69
SECRET_KEY: "secret_key"
70
70
```
71
71
72
-
Now create a file named `env.yaml.dist` and check this into the project. This
72
+
Now create a file named `env.yml.dist` and check this into the project. This
73
73
should have the ENV variables you need to have set, but the values should
74
74
either be blank or filled with dummy data. The idea is to let people know what
75
75
variables are required, but not give them the sensitive production values.
@@ -79,14 +79,14 @@ S3_BUCKET: "devbucket"
79
79
SECRET_KEY: "abc123"
80
80
```
81
81
82
-
You can then load `env.yaml` in your application with:
82
+
You can then load `env.yml` in your application with:
83
83
84
84
```php
85
85
$yamlenv = new Yamlenv\Yamlenv(__DIR__);
86
86
$yamlenv->load();
87
87
```
88
88
89
-
Optionally you can pass in a filename as the second parameter, if you would like to use something other than `env.yaml`
89
+
Optionally you can pass in a filename as the second parameter, if you would like to use something other than `env.yml`
90
90
91
91
```php
92
92
$yamlenv = new Yamlenv\Yamlenv(__DIR__, 'myconfig');
0 commit comments