Skip to content
This repository was archived by the owner on May 14, 2020. It is now read-only.

Commit f5039e3

Browse files
committed
Added server.modify.sha1_in_config option.
1 parent 072a8c3 commit f5039e3

File tree

7 files changed

+25
-8
lines changed

7 files changed

+25
-8
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
## [2.0.2] - 2020-01-27
2+
3+
### Added
4+
5+
- Option `server.modify.sha1_in_config`. Enable of disable `__config` name with passed VCS SHA1 from CI.
6+
7+
### Changed
8+
9+
None.
10+
11+
### Removed
12+
13+
None.
14+
115
## [2.0.1] - 2020-01-27
216

317
Prerender option now more configurable and supports many of sets

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Server created for javascript SPA apps like: Vue, React, Angular, etc.
2222
## Docker usage
2323

2424
```Dockerfile
25-
FROM microparts/static-server-php:2.0.1
25+
FROM microparts/static-server-php:2.0.2
2626

2727
ARG VCS_SHA1
2828
ARG STAGE
@@ -45,7 +45,7 @@ server run
4545

4646
Result:
4747
```bash
48-
[2019-12-18 17:38:30] Server.INFO: State: STAGE=local SHA1= VERSION=2.0.1 CONFIG_PATH=/Users/roquie/google_drive/projects/microparts/static-server-php/configuration
48+
[2019-12-18 17:38:30] Server.INFO: State: STAGE=local SHA1= VERSION=2.0.2 CONFIG_PATH=/Users/roquie/google_drive/projects/microparts/static-server-php/configuration
4949
[2019-12-18 17:38:30] Server.INFO: Files modification enabled. Have fun!.
5050
[2019-12-18 17:38:30] Server.INFO: Nginx Brotli module not installed. Turning off this compression method.
5151
[2019-12-18 17:38:30] Server.INFO: Check if platform supports async io...
@@ -68,7 +68,7 @@ server reload
6868
Reload command result:
6969
```bash
7070
[2019-12-18 17:41:44] Server.INFO: Reload configuration
71-
[2019-12-18 17:41:44] Server.INFO: State: STAGE=local SHA1= VERSION=2.0.1 CONFIG_PATH=/Users/roquie/google_drive/projects/microparts/static-server-php/configuration
71+
[2019-12-18 17:41:44] Server.INFO: State: STAGE=local SHA1= VERSION=2.0.2 CONFIG_PATH=/Users/roquie/google_drive/projects/microparts/static-server-php/configuration
7272
[2019-12-18 17:41:44] Server.INFO: Files modification enabled. Have fun!.
7373
[2019-12-18 17:41:44] Server.INFO: Nginx Brotli module not installed. Turning off this compression method.
7474
[2019-12-18 17:41:44] Server.INFO: Check if platform supports async io...

configuration/defaults/___server.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ defaults:
1111
# head -> Injects the __config.js to top of <head> tag. It will be block content rendering, so not recommended.
1212
# before_script -> Injects the __config.js before first <script> tag in DOM document. Better than `head` variant.
1313
inject: before_script # head/before_script
14+
sha1_in_config: false
1415
handler:
1516
name: nginx
1617
options:

src/Application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
final class Application
2424
{
25-
public const VERSION = '2.0.1';
25+
public const VERSION = '2.0.2';
2626
private const SERVER_LOG_CHANNEL = 'Server';
2727

2828
private Configuration $conf;

src/Modifier/DefaultPreferencesConfigurator.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ public function getModifier(): GenericModifyInterface
4747
$this->logger->info('Files modification enabled. Have fun!.');
4848

4949
$mod = new Modify();
50-
$location = $this->getConfigName('/__config.js');
50+
51+
$location = $this->configuration->get('server.modify.sha1_in_config', false)
52+
? $this->getConfigName('/__config.js')
53+
: '/__config.js';
5154

5255
$mod->addTemplate(__DIR__ . '/../stub/__config.js', $location);
5356
$mod->addTemplate(__DIR__ . '/../stub/security.txt', '/.well-known/security.txt');

tests/example_dist/vue/modified/__config_test.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/example_dist/vue/modified/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<meta charset="utf-8">
44
<meta http-equiv="X-UA-Compatible" content="IE=edge">
55
<meta name="viewport" content="width=device-width,initial-scale=1">
6-
<link rel="preload" href="/__config_test.js" as="script"><link rel="icon" href="/favicon.ico">
6+
<link rel="preload" href="/__config.js" as="script"><link rel="icon" href="/favicon.ico">
77
<title>example_dist</title>
88
<link href="/js/about.5273d30c.js" rel="prefetch">
99
<link href="/css/app.e28d37a7.css" rel="preload" as="style">
@@ -15,7 +15,7 @@
1515
<noscript><strong>We're sorry but example_dist doesn't work properly without JavaScript enabled. Please enable it to
1616
continue.</strong></noscript>
1717
<div id="app"></div>
18-
<script src="/__config_test.js"></script><script src="/js/chunk-vendors.a377004b.js"></script>
18+
<script src="/__config.js"></script><script src="/js/chunk-vendors.a377004b.js"></script>
1919
<script src="/js/app.06433c76.js"></script>
2020
</body>
2121

0 commit comments

Comments
 (0)