Skip to content

Commit 9142ea9

Browse files
authored
[PWA-1119] UPWARD Path Config (#7)
* Flag config as sensitive and environment specific * Fix whitespace * Add docs for changes
1 parent b8a6e33 commit 9142ea9

File tree

4 files changed

+21
-12
lines changed

4 files changed

+21
-12
lines changed

README.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,23 @@ The Magento 2 UPWARD connector module is part of the [Magento Cloud deployment][
1111

1212
## Configuration
1313

14-
The Magento 2 UPWARD connector is configured in the admin area under:
14+
The Magento 2 UPWARD connector has additional settings that can be configured in the admin area under:
1515

1616
**Stores > Configuration > General > Web > UPWARD PWA Configuration**.
1717

1818
### General configuration
1919

2020
These are the configurations for the UPWARD process itself.
21+
2122
#### UPWARD Config File
2223

2324
This configuration is the location of the UPWARD configuration file for the UPWARD-PHP server.
25+
It is recommended you follow [system-specific best practices][] and set this value with an environment variable or the `magento config:set` CLI command.
2426

25-
_Use the absolute path on the server for the value of this configuration._
27+
_You may use a path relative to your web root or an absolute path for the value of this configuration._
2628

27-
Example: `/app/node_modules/@magento/venia-concept/dist/upward.yml`
29+
Relative: `fastcgi_param CONFIG__DEFAULT__WEB__UPWARD__PATH pwa/upward.yml`
30+
Absolute: `magento config:set -e web/upward/path /app/node_modules/@magento/venia-concept/dist/upward.yml`
2831

2932
#### Front Name Allowlist
3033

@@ -61,7 +64,7 @@ If a page is not configured for prerendering, the request continues using the no
6164
To see how a crawler sees a prerendered page, set your browser's User Agent to `Googlebot` and visit your URL.
6265
You can also run this on the command line and change the sample URL to your storefront's URL:
6366

64-
``` sh
67+
```sh
6568
curl -A Googlebot https://www.example.com/ > page.html
6669
```
6770

@@ -74,9 +77,11 @@ For prerendering it is possible to force prerender to wait for a predefined time
7477

7578
Add the following to the runtime script:
7679

77-
``` js
80+
```js
7881
window.prerenderReady = false;
79-
setTimeout(function () { window.prerenderReady = true }, 1000 * 15)
82+
setTimeout(function () {
83+
window.prerenderReady = true;
84+
}, 1000 * 15);
8085
```
8186

8287
For more information, see https://docs.prerender.io/test-it/.
@@ -90,3 +95,4 @@ If you cannot avoid sharing the hostname, access one service at a time or use a
9095
[upward-php]: https://github.com/magento/upward-php
9196
[magento cloud deployment]: http://pwastudio.io/tutorials/cloud-deploy/
9297
[prerender.io]: https://docs.prerender.io/
98+
[system-specific best practices]: https://devdocs.magento.com/guides/v2.4/config-guide/prod/config-reference-var-name.html

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"php": "~7.3.0||~7.4.0",
99
"magento/framework": "*",
1010
"magento/upward": "*",
11+
"magento/module-config": "*",
1112
"magento/module-store": "*",
1213
"yireo/magento2-disable-service-worker-in-admin": "^0.0.2"
1314
},

etc/adminhtml/system.xml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,7 @@
1212
<group id="upward" translate="label" type="text" sortOrder="300"
1313
showInDefault="1" showInWebsite="0" showInStore="0">
1414
<label>UPWARD PWA Configuration</label>
15-
<field id="config_path" type="text" translate="label,comment"
16-
sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0">
17-
<label>UPWARD Config File</label>
18-
<config_path>web/upward/path</config_path>
19-
<comment>Server path to YAML configuration file for UPWARD</comment>
20-
</field>
15+
<field id="path" type="text" showInDefault="0" showInWebsite="0" showInStore="0" />
2116
<field id="front_names_to_skip" canRestore="1" showInDefault="1" showInStore="1" showInWebsite="1" sortOrder="30" translate="label,comment" type="textarea">
2217
<label>Front Name Allowlist</label>
2318
<comment>Line break separated list of URL's that will load the default Magento frontend.</comment>

etc/di.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,11 @@
1717
</arguments>
1818
<plugin name="upward_connector_app_areaList" sortOrder="10" type="Magento\UpwardConnector\Plugin\Magento\Framework\App\AreaList" />
1919
</type>
20+
<type name="Magento\Config\Model\Config\TypePool">
21+
<arguments>
22+
<argument name="environment" xsi:type="array">
23+
<item name="web/upward/path" xsi:type="string">1</item>
24+
</argument>
25+
</arguments>
26+
</type>
2027
</config>

0 commit comments

Comments
 (0)