From eb963923975bafe33323a80d61d1ccf506c3a39c Mon Sep 17 00:00:00 2001 From: zetlen Date: Tue, 9 Oct 2018 16:32:15 -0500 Subject: [PATCH] fix: rename MAGENTO_BACKEND_DOMAIN to MAGENTO_BACKEND_URL More accurately reflects the contents of the variable. Fixes #337. --- README.md | 2 +- packages/pwa-buildpack/README.md | 6 +++--- .../project-setup/create-configuration-files/index.md | 10 +++++----- .../webpack-config-example/index.md | 2 +- .../pwa-buildpack/reference/pwa-dev-server/index.md | 2 +- .../pwa-devdocs/src/venia-pwa-concept/setup/index.md | 4 ++-- packages/upward-spec/README.md | 2 +- packages/venia-concept/example.env | 2 +- packages/venia-concept/validate-queries.js | 2 +- packages/venia-concept/venia-upward.yml | 4 ++-- 10 files changed, 18 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 2bdc90c2a2..e9424df433 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ Follow these steps to install the dependencies for all the packages in the proje 2. Navigate to the root of the repository from the command line 3. Run `npm install` 4. Copy `packages/venia-concept/example.env` to `packages/venia-concept/.env` -5. Uncomment the line for `MAGENTO_BACKEND_DOMAIN` in `packages/venia-concept/.env`, and set `MAGENTO_BACKEND_DOMAIN` to the fully-qualified URL of a Magento store running `2.3`. +5. Uncomment the line for `MAGENTO_BACKEND_URL` in `packages/venia-concept/.env`, and set `MAGENTO_BACKEND_URL` to the fully-qualified URL of a Magento store running `2.3`. 6. On your first install, run `npm run build` from package root. 7. To run the Venia storefront development experience, run `npm run watch:venia` from package root. diff --git a/packages/pwa-buildpack/README.md b/packages/pwa-buildpack/README.md index 4cc32216ee..80e254904b 100644 --- a/packages/pwa-buildpack/README.md +++ b/packages/pwa-buildpack/README.md @@ -123,7 +123,7 @@ which reads an ini-formatted file to set the environment. in it: ```sh - MAGENTO_BACKEND_DOMAIN=https://localhost.magento:8008 + MAGENTO_BACKEND_URL=https://localhost.magento:8008 # change the above to your local Magento store's host (with port) MAGENTO_PATH=~/path/to/magento/rootdir @@ -189,7 +189,7 @@ which reads an ini-formatted file to set the environment. `process.env`. _If you like, you can prove this is working by adding another line that says - `console.log(process.env.MAGENTO_BACKEND_DOMAIN)`. Save the file and then run + `console.log(process.env.MAGENTO_BACKEND_URL)`. Save the file and then run `node webpack.config.js`._ 1. Add the following lines to `webpack.config.js`: @@ -307,7 +307,7 @@ which reads an ini-formatted file to set the environment. if (env.mode === "development") { config.devServer = await PWADevServer.configure({ publicPath: process.env.MAGENTO_BACKEND_PUBLIC_PATH, - backendDomain: process.env.MAGENTO_BACKEND_DOMAIN, + backendDomain: process.env.MAGENTO_BACKEND_URL, serviceWorkerFileName: process.env.SERVICE_WORKER_FILE_NAME, paths: themePaths, id: 'magento-my-theme' diff --git a/packages/pwa-devdocs/src/pwa-buildpack/project-setup/create-configuration-files/index.md b/packages/pwa-devdocs/src/pwa-buildpack/project-setup/create-configuration-files/index.md index 9b1dca193e..66185556c2 100644 --- a/packages/pwa-devdocs/src/pwa-buildpack/project-setup/create-configuration-files/index.md +++ b/packages/pwa-devdocs/src/pwa-buildpack/project-setup/create-configuration-files/index.md @@ -43,7 +43,7 @@ In general, these plugins provide convenience and produce cleaner code in your p Create a `.env` file and assign values to the following environment variables: -* `MAGENTO_BACKEND_DOMAIN` - Your local Magento store’s host and port. +* `MAGENTO_BACKEND_URL` - Your local Magento store’s host and port. * `MAGENTO_BACKEND_PUBLIC_PATH` - PWA files are served from root during development, but this environment variable can later be used to simulate a deployed static path. * `SERVICE_WORKER_FILE_NAME` - Set this value to `"sw.js"`. @@ -51,7 +51,7 @@ Create a `.env` file and assign values to the following environment variables: Your file should look like the following: ``` text -MAGENTO_BACKEND_DOMAIN=https://localhost.magento:8008 +MAGENTO_BACKEND_URL=https://localhost.magento:8008 MAGENTO_BACKEND_PUBLIC_PATH=/ @@ -77,10 +77,10 @@ require('dotenv').config(); This imports the the contents of the `.env` file as environment variables using the `dotenv` module. These environment variables are accessed using the `process.env` global object. -For example, the following code outputs the value of the `MAGENTO_BACKEND_DOMAIN` environment variable: +For example, the following code outputs the value of the `MAGENTO_BACKEND_URL` environment variable: ``` javascript -console.log(process.env.MAGENTO_BACKEND_DOMAIN); +console.log(process.env.MAGENTO_BACKEND_URL); ``` ### Import Webpack and pwa-buildpack libraries @@ -195,7 +195,7 @@ Add the following development mode configuration before returning the `config` o if (env.phase === "development") { config.devServer = await PWADevServer.configure({ publicPath: process.env.MAGENTO_BACKEND_PUBLIC_PATH, - backendDomain: process.env.MAGENTO_BACKEND_DOMAIN, + backendDomain: process.env.MAGENTO_BACKEND_URL, serviceWorkerFileName: process.env.SERVICE_WORKER_FILE_NAME, paths: themePaths, id: path.basename(__dirname) // Defaults to theme directory name diff --git a/packages/pwa-devdocs/src/pwa-buildpack/project-setup/create-configuration-files/webpack-config-example/index.md b/packages/pwa-devdocs/src/pwa-buildpack/project-setup/create-configuration-files/webpack-config-example/index.md index ea818ca479..7b9409a9e5 100644 --- a/packages/pwa-devdocs/src/pwa-buildpack/project-setup/create-configuration-files/webpack-config-example/index.md +++ b/packages/pwa-devdocs/src/pwa-buildpack/project-setup/create-configuration-files/webpack-config-example/index.md @@ -81,7 +81,7 @@ module.exports = async function(env) { if (env.phase === "development") { config.devServer = await PWADevServer.configure({ publicPath: process.env.MAGENTO_BACKEND_PUBLIC_PATH, - backendDomain: process.env.MAGENTO_BACKEND_DOMAIN, + backendDomain: process.env.MAGENTO_BACKEND_URL, serviceWorkerFileName: process.env.SERVICE_WORKER_FILE_NAME, paths: themePaths, id: path.basename(__dirname) // Defaults to theme directory name diff --git a/packages/pwa-devdocs/src/pwa-buildpack/reference/pwa-dev-server/index.md b/packages/pwa-devdocs/src/pwa-buildpack/reference/pwa-dev-server/index.md index ee533c13aa..648d0f0c89 100644 --- a/packages/pwa-devdocs/src/pwa-buildpack/reference/pwa-dev-server/index.md +++ b/packages/pwa-devdocs/src/pwa-buildpack/reference/pwa-dev-server/index.md @@ -24,7 +24,7 @@ feature to replace components and stylesheets inline. The `devServer` acts as a proxy server for API and media requests to Magento. It is configured using environment variables. -The `MAGENTO_BACKEND_DOMAIN` environment variable configures the proxy server +The `MAGENTO_BACKEND_URL` environment variable configures the proxy server to accept GraphQL, REST, and media requests and passes them to Magento. The `MAGENTO_BACKEND_PUBLIC_PATH` environment variable allows the proxy server diff --git a/packages/pwa-devdocs/src/venia-pwa-concept/setup/index.md b/packages/pwa-devdocs/src/venia-pwa-concept/setup/index.md index ede4f01291..03ed360d98 100644 --- a/packages/pwa-devdocs/src/venia-pwa-concept/setup/index.md +++ b/packages/pwa-devdocs/src/venia-pwa-concept/setup/index.md @@ -160,11 +160,11 @@ cd /Users/magedev/pwa-studio/packages/venia-concept cp .env.dist .env ``` -In the `.env` file set the value of `MAGENTO_BACKEND_DOMAIN` to the URL of your Magento development store. +In the `.env` file set the value of `MAGENTO_BACKEND_URL` to the URL of your Magento development store. **Example:** ``` text -MAGENTO_BACKEND_DOMAIN="https://magento.test/" +MAGENTO_BACKEND_URL="https://magento.test/" ``` ## Step 5. Start the server diff --git a/packages/upward-spec/README.md b/packages/upward-spec/README.md index 3d1c006498..7864760a05 100644 --- a/packages/upward-spec/README.md +++ b/packages/upward-spec/README.md @@ -944,7 +944,7 @@ A ProxyResolver is an important part of the UPWARD philosophy: a PWA's UPWARD fi ```yaml proxy: - target: env.MAGENTO_BACKEND_DOMAIN + target: env.MAGENTO_BACKEND_URL ignoreSSLErrors: true ``` diff --git a/packages/venia-concept/example.env b/packages/venia-concept/example.env index fe8a8b706d..5e29e2677d 100644 --- a/packages/venia-concept/example.env +++ b/packages/venia-concept/example.env @@ -15,7 +15,7 @@ # # Connect to an instance of Magento 2.3 by specifying its public # domain name. **REQUIRED.** Example: -# MAGENTO_BACKEND_DOMAIN="https://magento2.local" +# MAGENTO_BACKEND_URL="https://magento2.local" # # Use a particular website code when making API calls. Defaults to 'base', # but for your PWA to act as a different "website" in the Magento admin, diff --git a/packages/venia-concept/validate-queries.js b/packages/venia-concept/validate-queries.js index 0836640e47..2eeacdeba4 100644 --- a/packages/venia-concept/validate-queries.js +++ b/packages/venia-concept/validate-queries.js @@ -1,6 +1,6 @@ require('dotenv').config(); process.env.NODE_TLS_REJECT_UNAUTHORIZED = 0; -const magentoDomainVarName = 'MAGENTO_BACKEND_DOMAIN'; +const magentoDomainVarName = 'MAGENTO_BACKEND_URL'; const magentoDomain = process.env[magentoDomainVarName]; if (!magentoDomain) { console.error( diff --git a/packages/venia-concept/venia-upward.yml b/packages/venia-concept/venia-upward.yml index c1b7c17bb5..124305130d 100644 --- a/packages/venia-concept/venia-upward.yml +++ b/packages/venia-concept/venia-upward.yml @@ -19,7 +19,7 @@ response: default: static proxy: - target: env.MAGENTO_BACKEND_DOMAIN + target: env.MAGENTO_BACKEND_URL ignoreSSLErrors: inline: true @@ -79,7 +79,7 @@ urlResolverResult: magentoGQL: engine: mustache template: - inline: '{{env.MAGENTO_BACKEND_DOMAIN}}/graphql' + inline: '{{env.MAGENTO_BACKEND_URL}}/graphql' provide: - env