Skip to content

Commit

Permalink
ci!: add VSF_ prefix to environment variables
Browse files Browse the repository at this point in the history
add VSF_ prefix where omitted
  • Loading branch information
sethidden committed Apr 5, 2022
1 parent ea50ca1 commit ffa6440
Show file tree
Hide file tree
Showing 12 changed files with 159 additions and 149 deletions.
49 changes: 26 additions & 23 deletions .github/workflows/deploy-vue-storefront-cloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,40 +26,43 @@ jobs:
password: ${{ secrets.CLOUD_PASSWORD }}
dockerfile: .vuestorefrontcloud/docker/Dockerfile
buildoptions: --compress
buildargs: NPM_EMAIL,NPM_PASS,NPM_USER,NPM_REGISTRY,STORE_URL,MAGENTO_BASE_URL,MAGENTO_GRAPHQL_URL,MAGENTO_EXTERNAL_CHECKOUT_ENABLED,MAGENTO_EXTERNAL_CHECKOUT_URL,MAGENTO_EXTERNAL_CHECKOUT_SYNC_PATH,IMAGE_PROVIDER,IMAGE_PROVIDER_BASE_URL,REDIS_HOST,REDIS_PORT,REDIS_CACHE_INVALIDATE_KEY,REDIS_CACHE_INVALIDATE_URL,REDIS_KEY_PREFIX,REDIS_ENABLED,SENTRY_DSN,RECAPTCHA_ENABLED,RECAPTCHA_HIDE_BADGE,RECAPTCHA_VERSION,RECAPTCHA_SIZE,RECAPTCHA_MIN_SCORE,RECAPTCHA_SITE_KEY,RECAPTCHA_SECRET_KEY
buildargs: NPM_EMAIL,NPM_PASS,NPM_USER,NPM_REGISTRY,LAST_COMMIT,VSF_STORE_URL,VSF_MAGENTO_BASE_URL,VSF_MAGENTO_GRAPHQL_URL,VSF_MAGENTO_EXTERNAL_CHECKOUT_ENABLED,VSF_MAGENTO_EXTERNAL_CHECKOUT_URL,VSF_MAGENTO_EXTERNAL_CHECKOUT_SYNC_PATH,VSF_IMAGE_PROVIDER,VSF_IMAGE_PROVIDER_BASE_URL,VSF_REDIS_HOST,VSF_REDIS_PORT,VSF_REDIS_CACHE_INVALIDATE_KEY,VSF_REDIS_CACHE_INVALIDATE_URL,VSF_REDIS_KEY_PREFIX,VSF_REDIS_ENABLED,VSF_RECAPTCHA_ENABLED,VSF_RECAPTCHA_HIDE_BADGE,VSF_RECAPTCHA_VERSION,VSF_RECAPTCHA_SIZE,VSF_RECAPTCHA_MIN_SCORE,VSF_RECAPTCHA_SITE_KEY,VSF_RECAPTCHA_SECRET_KEY,VSF_SENTRY_DSN,

env:
NPM_EMAIL: ${{ secrets.NPM_EMAIL }}
NPM_USER: ${{ secrets.CLOUD_USERNAME }}
NPM_PASS: ${{ secrets.CLOUD_PASSWORD }}
NPM_REGISTRY: https://registrynpm.storefrontcloud.io

STORE_URL: '' # TODO
VSF_STORE_URL: '' # TODO

VSF_MAGENTO_BASE_URL: https://magento2-instance.vuestorefront.io/
VSF_MAGENTO_GRAPHQL_URL: https://magento2-instance.vuestorefront.io/graphql
VSF_MAGENTO_EXTERNAL_CHECKOUT_ENABLED: false
VSF_MAGENTO_EXTERNAL_CHECKOUT_URL: ''
VSF_MAGENTO_EXTERNAL_CHECKOUT_SYNC_PATH: ''

MAGENTO_BASE_URL: https://magento2-instance.vuestorefront.io/
MAGENTO_GRAPHQL_URL: https://magento2-instance.vuestorefront.io/graphql
MAGENTO_EXTERNAL_CHECKOUT_ENABLED: false
MAGENTO_EXTERNAL_CHECKOUT_URL: ''
MAGENTO_EXTERNAL_CHECKOUT_SYNC_PATH: ''
VSF_IMAGE_PROVIDER: cloudinary
VSF_IMAGE_PROVIDER_BASE_URL: https://res-4.cloudinary.com/dnozky7on/image/upload/

IMAGE_PROVIDER: cloudinary
IMAGE_PROVIDER_BASE_URL: https://res-4.cloudinary.com/dnozky7on/image/upload/
VSF_REDIS_ENABLED: true
VSF_REDIS_HOST: localhost
VSF_REDIS_PORT: 6379
VSF_REDIS_KEY_PREFIX: ${{ github.sha }}
VSF_REDIS_CACHE_INVALIDATE_KEY: magento2vsf2
VSF_REDIS_CACHE_INVALIDATE_URL: /cache-invalidate

REDIS_ENABLED: true
REDIS_HOST: localhost
REDIS_PORT: 6379
REDIS_KEY_PREFIX: ${{ github.sha }}
REDIS_CACHE_INVALIDATE_KEY: magento2vsf2
REDIS_CACHE_INVALIDATE_URL: /cache-invalidate
VSF_RECAPTCHA_ENABLED: false
VSF_RECAPTCHA_HIDE_BADGE: false
VSF_RECAPTCHA_VERSION: 3
VSF_RECAPTCHA_SIZE: invisible
VSF_RECAPTCHA_MIN_SCORE: 0.5
VSF_RECAPTCHA_SITE_KEY: 6Ldce0EeAAAAAAGGtGWG-e-SygXiFub6PXHT5fKd
VSF_RECAPTCHA_SECRET_KEY: ${{ secrets.RECAPTCHA_SECRET_KEY }}

RECAPTCHA_ENABLED: false
RECAPTCHA_HIDE_BADGE: false
RECAPTCHA_VERSION: 3
RECAPTCHA_SIZE: invisible
RECAPTCHA_MIN_SCORE: 0.5
RECAPTCHA_SITE_KEY: 6Ldce0EeAAAAAAGGtGWG-e-SygXiFub6PXHT5fKd
RECAPTCHA_SECRET_KEY: ${{ secrets.RECAPTCHA_SECRET_KEY }}
VSF_SENTRY_DSN: ${{ secrets.SENTRY_DSN }}

SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
LAST_COMMIT: ${{ github.sha }}

deploy-main:
uses: ./.github/workflows/deployment-template.yml
Expand Down
107 changes: 57 additions & 50 deletions .vuestorefrontcloud/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,59 +1,66 @@
FROM node:16

ARG COMMIT
ARG LAST_COMMIT
ARG NPM_USER
ARG NPM_PASS
ARG NPM_EMAIL
ARG NPM_REGISTRY
ARG MAGENTO_BASE_URL
ARG MAGENTO_GRAPHQL_URL
ARG MAGENTO_EXTERNAL_CHECKOUT_ENABLED
ARG MAGENTO_EXTERNAL_CHECKOUT_URL
ARG MAGENTO_EXTERNAL_CHECKOUT_SYNC_PATH
ARG STORE_URL
ARG IMAGE_PROVIDER
ARG IMAGE_PROVIDER_BASE_URL
ARG REDIS_ENABLED
ARG REDIS_HOST
ARG REDIS_PORT
ARG REDIS_KEY_PREFIX
ARG REDIS_CACHE_INVALIDATE_URL
ARG REDIS_CACHE_INVALIDATE_KEY
ARG RECAPTCHA_ENABLED
ARG RECAPTCHA_HIDE_BADGE
ARG RECAPTCHA_VERSION
ARG RECAPTCHA_SIZE
ARG RECAPTCHA_MIN_SCORE
ARG RECAPTCHA_SITE_KEY
ARG RECAPTCHA_SECRET_KEY
ARG SENTRY_DSN

ENV NUXT_APP_ENV=production
ENV NUXT_APP_PORT=3000

ENV MAGENTO_BASE_URL=${MAGENTO_BASE_URL}
ENV MAGENTO_GRAPHQL_URL=${MAGENTO_GRAPHQL_URL}
ENV MAGENTO_EXTERNAL_CHECKOUT_ENABLED=${MAGENTO_EXTERNAL_CHECKOUT_ENABLED}
ENV MAGENTO_EXTERNAL_CHECKOUT_URL=${MAGENTO_EXTERNAL_CHECKOUT_URL}
ENV MAGENTO_EXTERNAL_CHECKOUT_SYNC_PATH=${MAGENTO_EXTERNAL_CHECKOUT_SYNC_PATH}
ENV STORE_URL=${STORE_URL}
ENV LAST_COMMIT=${COMMIT}
ENV IMAGE_PROVIDER=${IMAGE_PROVIDER}
ENV IMAGE_PROVIDER_BASE_URL=${IMAGE_PROVIDER_BASE_URL}
ENV REDIS_ENABLED=${REDIS_ENABLED}
ENV REDIS_HOST=${REDIS_HOST}
ENV REDIS_PORT=${REDIS_PORT}
ENV REDIS_KEY_PREFIX=${REDIS_KEY_PREFIX}
ENV REDIS_CACHE_INVALIDATE_KEY=${REDIS_CACHE_INVALIDATE_KEY}
ENV REDIS_CACHE_INVALIDATE_URL=${REDIS_CACHE_INVALIDATE_URL}
ENV SENTRY_DSN=${SENTRY_DSN}
ENV RECAPTCHA_ENABLED=${RECAPTCHA_ENABLED}
ENV RECAPTCHA_HIDE_BADGE=${RECAPTCHA_HIDE_BADGE}
ENV RECAPTCHA_VERSION=${RECAPTCHA_VERSION}
ENV RECAPTCHA_SIZE=${RECAPTCHA_SIZE}
ENV RECAPTCHA_MIN_SCORE=${RECAPTCHA_MIN_SCORE}
ENV RECAPTCHA_SITE_KEY=${RECAPTCHA_SITE_KEY}
ENV RECAPTCHA_SECRET_KEY=${RECAPTCHA_SITE_KEY}

ARG VSF_STORE_URL

ARG VSF_MAGENTO_BASE_URL
ARG VSF_MAGENTO_GRAPHQL_URL
ARG VSF_MAGENTO_EXTERNAL_CHECKOUT_ENABLED
ARG VSF_MAGENTO_EXTERNAL_CHECKOUT_URL
ARG VSF_MAGENTO_EXTERNAL_CHECKOUT_SYNC_PATH

ARG VSF_IMAGE_PROVIDER
ARG VSF_IMAGE_PROVIDER_BASE_URL

ARG VSF_REDIS_ENABLED
ARG VSF_REDIS_HOST
ARG VSF_REDIS_PORT
ARG VSF_REDIS_KEY_PREFIX
ARG VSF_REDIS_CACHE_INVALIDATE_URL
ARG VSF_REDIS_CACHE_INVALIDATE_KEY

ARG VSF_RECAPTCHA_ENABLED
ARG VSF_RECAPTCHA_HIDE_BADGE
ARG VSF_RECAPTCHA_VERSION
ARG VSF_RECAPTCHA_SIZE
ARG VSF_RECAPTCHA_MIN_SCORE
ARG VSF_RECAPTCHA_SITE_KEY
ARG VSF_RECAPTCHA_SECRET_KEY

ARG VSF_SENTRY_DSN

ENV LAST_COMMIT=${LAST_COMMIT}

ENV VSF_NUXT_APP_ENV=production
ENV VSF_NUXT_APP_PORT=3000

ENV VSF_MAGENTO_BASE_URL=${VSF_MAGENTO_BASE_URL}
ENV VSF_MAGENTO_GRAPHQL_URL=${VSF_MAGENTO_GRAPHQL_URL}
ENV VSF_MAGENTO_EXTERNAL_CHECKOUT_ENABLED=${VSF_MAGENTO_EXTERNAL_CHECKOUT_ENABLED}
ENV VSF_MAGENTO_EXTERNAL_CHECKOUT_URL=${VSF_MAGENTO_EXTERNAL_CHECKOUT_URL}
ENV VSF_MAGENTO_EXTERNAL_CHECKOUT_SYNC_PATH=${VSF_MAGENTO_EXTERNAL_CHECKOUT_SYNC_PATH}
ENV VSF_STORE_URL=${VSF_STORE_URL}
ENV VSF_IMAGE_PROVIDER=${VSF_IMAGE_PROVIDER}
ENV VSF_IMAGE_PROVIDER_BASE_URL=${VSF_IMAGE_PROVIDER_BASE_URL}
ENV VSF_REDIS_ENABLED=${VSF_REDIS_ENABLED}
ENV VSF_REDIS_HOST=${VSF_REDIS_HOST}
ENV VSF_REDIS_PORT=${VSF_REDIS_PORT}
ENV VSF_REDIS_KEY_PREFIX=${VSF_REDIS_KEY_PREFIX}
ENV VSF_REDIS_CACHE_INVALIDATE_KEY=${VSF_REDIS_CACHE_INVALIDATE_KEY}
ENV VSF_REDIS_CACHE_INVALIDATE_URL=${VSF_REDIS_CACHE_INVALIDATE_URL}
ENV VSF_SENTRY_DSN=${VSF_SENTRY_DSN}
ENV VSF_RECAPTCHA_ENABLED=${VSF_RECAPTCHA_ENABLED}
ENV VSF_RECAPTCHA_HIDE_BADGE=${VSF_RECAPTCHA_HIDE_BADGE}
ENV VSF_RECAPTCHA_VERSION=${VSF_RECAPTCHA_VERSION}
ENV VSF_RECAPTCHA_SIZE=${VSF_RECAPTCHA_SIZE}
ENV VSF_RECAPTCHA_MIN_SCORE=${VSF_RECAPTCHA_MIN_SCORE}
ENV VSF_RECAPTCHA_SITE_KEY=${VSF_RECAPTCHA_SITE_KEY}
ENV VSF_RECAPTCHA_SECRET_KEY=${VSF_RECAPTCHA_SITE_KEY}

RUN npm config set @vsf-enterprise:registry=https://registrynpm.storefrontcloud.io

Expand Down
2 changes: 1 addition & 1 deletion .vuestorefrontcloud/docker/nuxt.config.additional.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default () => {
'@nuxtjs/sentry'
],
sentry: {
dsn: process.env.SENTRY_DSN,
dsn: process.env.VSF_SENTRY_DSN,
tracing: true,
},
};
Expand Down
4 changes: 2 additions & 2 deletions docs/guide/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ By default, we use the `ipx` provider. that means the images are fetched from Ma
2. Configure your provider in `nuxt.config.js`. Here is the example:
```javascript
image: {
provider: process.env.IMAGE_PROVIDER
provider: process.env.VSF_IMAGE_PROVIDER
magekit: {
baseURL: process.env.IMAGE_PROVIDER_BASE_URL
baseURL: process.env.VSF_IMAGE_PROVIDER_BASE_URL
}
},
```
Expand Down
29 changes: 14 additions & 15 deletions docs/guide/ssr.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ The cached pages are:

To invalidate a tag and remove pages associated with that tag, use the [Invalidation endpoint](https://docs.vuestorefront.io/v2/performance/ssr-cache.html#invalidating-tags).

Go to the route configured in the `.env` file under the `REDIS_CACHE_INVALIDATE_KEY` key with two query parameters:
* `key` — string matching the `REDIS_CACHE_INVALIDATE_KEY` key in the `.env` file.
Go to the route configured in the `.env` file under the `VSF_REDIS_CACHE_INVALIDATE_KEY` key with two query parameters:
* `key` — string matching the `VSF_REDIS_CACHE_INVALIDATE_KEY` key in the `.env` file.
* `tags` — a comma-separated list of tags for invalidation.

Assuming that you are running the application locally, the `REDIS_CACHE_INVALIDATE_URL` key is equal to `/cache-invalidate,` and the `REDIS_CACHE_INVALIDATE_KEY` key is equal to `secret_key`, and you want to invalidate the `Vhome` tag, the full URL will look like this:
Assuming that you are running the application locally, the `VSF_REDIS_CACHE_INVALIDATE_URL` key is equal to `/cache-invalidate,` and the `VSF_REDIS_CACHE_INVALIDATE_KEY` key is equal to `secret_key`, and you want to invalidate the `Vhome` tag, the full URL will look like this:

## How to cache other pages

Expand Down Expand Up @@ -50,22 +50,21 @@ Once you have the Redis driver installed, you need to add the Redis configuratio

```
.env
REDIS_HOST=127.0.0.1
REDIS_PORT=6379
REDIS_PASSWORD=
REDIS_KEY_PREFIX=
REDIS_CACHE_INVALIDATE_URL=/cache-invalidate
REDIS_ENABLED=true
VSF_REDIS_HOST=127.0.0.1
VSF_REDIS_PORT=6379
VSF_REDIS_KEY_PREFIX=
VSF_REDIS_CACHE_INVALIDATE_URL=/cache-invalidate
VSF_REDIS_ENABLED=true
```

Then you have to update `nuxt.config.js file` and add this to the `modules` object:

```javascript
['@vue-storefront/cache/nuxt', {
enabled: process.env.REDIS_ENABLED,
enabled: process.env.VSF_REDIS_ENABLED,
invalidation: {
endpoint: process.env.REDIS_CACHE_INVALIDATE_URL,
key: process.env.REDIS_CACHE_INVALIDATE_KEY,
endpoint: process.env.VSF_REDIS_CACHE_INVALIDATE_URL,
key: process.env.VSF_REDIS_CACHE_INVALIDATE_KEY,
handlers: [
'@vue-storefront/cache/defaultHandler',
],
Expand All @@ -75,9 +74,9 @@ Then you have to update `nuxt.config.js file` and add this to the `modules` obje
{
// docs: https://github.com/luin/ioredis/blob/master/API.md#new-redisport-host-options
redis: {
keyPrefix: process.env.REDIS_KEY_PREFIX,
host: process.env.REDIS_HOST,
port: process.env.REDIS_PORT,
keyPrefix: process.env.VSF_REDIS_KEY_PREFIX,
host: process.env.VSF_REDIS_HOST,
port: process.env.VSF_REDIS_PORT,
},
},
],
Expand Down
2 changes: 1 addition & 1 deletion packages/api-client/.env.example
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MAGENTO_GRAPHQL_URL=https://{YOUR_SITE_FRONT_URL}/graphql
VSF_MAGENTO_GRAPHQL_URL=https://{YOUR_SITE_FRONT_URL}/graphql
4 changes: 2 additions & 2 deletions packages/api-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ Find more information about the module [GraphQl Custom Config](https://github.co
```bash
$ cp packages/theme/.env.example packages/theme/config/.env
```
6. Update `MAGENT_GRAPHQL_URL` with url to Magento >=2.4.2 GraphQL endpoint, and the other variable accordingly to your store configurations.
6. Update `VSF_MAGENTO_GRAPHQL_URL` with url to Magento >=2.4.2 GraphQL endpoint, and the other variable accordingly to your store configurations.
```
MAGENTO_GRAPHQL_URL=https://{YOUR_SITE_FRONT_URL}/graphql
VSF_MAGENTO_GRAPHQL_URL=https://{YOUR_SITE_FRONT_URL}/graphql
```
7. Build dependencies `yarn build:api-client && yarn build:composables`
8. Run `yarn dev:theme` to run theme. You can find other commands in `package.json`
Expand Down
2 changes: 1 addition & 1 deletion packages/api-client/possible-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require('dotenv').config();
const fetch = require('cross-fetch');
const fs = require('fs');

fetch(process.env.MAGENTO_GRAPHQL_URL, {
fetch(process.env.VSF_MAGENTO_GRAPHQL_URL, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
Expand Down
4 changes: 2 additions & 2 deletions packages/composables/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ Find more information about the module [GraphQl Custom Config](https://github.co
```bash
$ cp packages/theme/.env.example packages/theme/.env
```
6. Update `MAGENTO_GRAPHQL_URL` with url to Magento >=2.4.2 GraphQL endpoint, and the other variable accordingly to your store configurations.
6. Update `VSF_MAGENTO_GRAPHQL_URL` with url to Magento >=2.4.2 GraphQL endpoint, and the other variable accordingly to your store configurations.
```
MAGENTO_GRAPHQL_URL=https://{YOUR_SITE_FRONT_URL}/graphql
VSF_MAGENTO_GRAPHQL_URL=https://{YOUR_SITE_FRONT_URL}/graphql
```
7. Build dependencies `yarn build:api-client && yarn build:composables`
8. Run `yarn dev:theme` to run theme. You can find other commands in `package.json`
Expand Down
45 changes: 23 additions & 22 deletions packages/theme/.env.example
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
STORE_URL=http://localhost:3000
NUXT_APP_ENV=development
NUXT_APP_PORT=3000
VSF_NUXT_APP_ENV=development
VSF_NUXT_APP_PORT=3000

MAGENTO_BASE_URL={YOUR_SITE_FRONT_URL}
MAGENTO_GRAPHQL_URL=https://{YOUR_SITE_FRONT_URL}/graphql
VSF_STORE_URL=http://localhost:3000

MAGENTO_EXTERNAL_CHECKOUT_ENABLED=false
MAGENTO_EXTERNAL_CHECKOUT_URL=https://{YOUR_SITE_FRONT_URL}
MAGENTO_EXTERNAL_CHECKOUT_SYNC_PATH=/vue/cart/sync
VSF_MAGENTO_BASE_URL={YOUR_SITE_FRONT_URL}
VSF_MAGENTO_GRAPHQL_URL=https://{YOUR_SITE_FRONT_URL}/graphql

IMAGE_PROVIDER=cloudinary
IMAGE_PROVIDER_BASE_URL=https://res-4.cloudinary.com/{YOUR_ID}/image/upload/
VSF_MAGENTO_EXTERNAL_CHECKOUT_ENABLED=false
VSF_MAGENTO_EXTERNAL_CHECKOUT_URL=https://{YOUR_SITE_FRONT_URL}
VSF_MAGENTO_EXTERNAL_CHECKOUT_SYNC_PATH=/vue/cart/sync

REDIS_ENABLED=false
REDIS_HOST=127.0.0.1
REDIS_PORT=6379
REDIS_KEY_PREFIX=
REDIS_CACHE_INVALIDATE_URL=/cache-invalidate
VSF_IMAGE_PROVIDER=cloudinary
VSF_IMAGE_PROVIDER_BASE_URL=https://res-4.cloudinary.com/{YOUR_ID}/image/upload/

RECAPTCHA_ENABLED=false
RECAPTCHA_SITE_KEY=
RECAPTCHA_SECRET_KEY=
RECAPTCHA_HIDE_BADGE=
RECAPTCHA_SIZE=invisible
RECAPTCHA_MIN_SCORE=0.5
RECAPTCHA_VERSION=3
VSF_REDIS_ENABLED=false
VSF_REDIS_HOST=127.0.0.1
VSF_REDIS_PORT=6379
VSF_REDIS_KEY_PREFIX=
VSF_REDIS_CACHE_INVALIDATE_URL=/cache-invalidate

VSF_RECAPTCHA_ENABLED=false
VSF_RECAPTCHA_SITE_KEY=
VSF_RECAPTCHA_SECRET_KEY=
VSF_RECAPTCHA_HIDE_BADGE=
VSF_RECAPTCHA_SIZE=invisible
VSF_RECAPTCHA_MIN_SCORE=0.5
VSF_RECAPTCHA_VERSION=3
Loading

0 comments on commit ffa6440

Please sign in to comment.