@toptal/davinci-ci 7.3.2 → 7.4.1

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Change Log
2
2
 
3
+ ## 7.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2380](https://github.com/toptal/davinci/pull/2380) [`262d4029`](https://github.com/toptal/davinci/commit/262d4029c66f284bd20ab4028d9a9c0fea31900a) Thanks [@sashuk](https://github.com/sashuk)!
8
+ - move env variables replacement into entrypoint script
9
+
10
+ ## 7.4.0
11
+
12
+ ### Minor Changes
13
+
14
+ - [#2368](https://github.com/toptal/davinci/pull/2368) [`676ef4fd`](https://github.com/toptal/davinci/commit/676ef4fdc68cee6766903fb811274c470bf3a5ee) Thanks [@sashuk](https://github.com/sashuk)!
15
+ - add ability to override environment variables by reading environment files
16
+
3
17
  ## 7.3.2
4
18
 
5
19
  ### Patch Changes
package/README.md CHANGED
@@ -85,6 +85,8 @@ The image is present on path `src/configs/docker/Dockerfile.gha-deploy` and have
85
85
  | `NGINX_CONFIG` | Ngninx config, davinci has an example file present at `src/configs/docker/nginx-vhost.conf` | Yes |
86
86
  | `HTML_CDN_CACHE_TAG` | `Cache-Tag` header for HTML documents, used for specific cache purging | No |
87
87
 
88
+ The default entrypoint `src/configs/docker/env-runtime.entrypoint.sh` reads environment file (`.env.$DAVINCI_ENV` has to be located in the root of the dist folder) and populates the environment variables with values from the file if the overriden environment variable is not set. Variables that are provided to `docker run` command (for example, `docker run -e DAVINCI_envvar1=1`) have higher priority that variables from the envrionment file.
89
+
88
90
  ### IDE Tooling
89
91
 
90
92
  This package can be used directly in your IDE through these extensions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toptal/davinci-ci",
3
- "version": "7.3.2",
3
+ "version": "7.4.1",
4
4
  "keywords": [
5
5
  "ci",
6
6
  "docker",
@@ -13,7 +13,25 @@
13
13
 
14
14
  # keep in sync with index.html
15
15
  VARS_PREFIX="DAVINCI_"
16
- INDEX_FILE="/usr/share/nginx/html/index.html"
16
+ DIST_PATH="/usr/share/nginx/html"
17
+ INDEX_FILE="$DIST_PATH/index.html"
18
+
19
+ # import environment variables from .env.DAVINCI_ENV files if there are any
20
+ ENV_FILE="$DIST_PATH/.env.$DAVINCI_ENV"
21
+ if [ -f "$ENV_FILE" ]; then
22
+ echo "Info: $ENV_FILE exists, importing variables..."
23
+
24
+ # Store current environment variables
25
+ OLD_ENV="$(export -p)"
26
+
27
+ # Load env file variables
28
+ export $(grep -v '^#' $ENV_FILE | xargs)
29
+
30
+ # Override env variables with previous values
31
+ eval "$OLD_ENV"
32
+ else
33
+ echo "Info: $ENV_FILE does not exist"
34
+ fi
17
35
 
18
36
  VARS="$(env | grep $VARS_PREFIX | awk -F = '{print $1}')"
19
37
 
@@ -18,4 +18,9 @@ server {
18
18
  add_header Cache-Tag "davinci,spa,index-doc,${HTML_CDN_CACHE_TAG}";
19
19
  try_files $uri /index.html;
20
20
  }
21
+
22
+ # forbid environment files download
23
+ location ~ ^/\.env\. {
24
+ deny all;
25
+ }
21
26
  }