[web] Prefer .local files for local only configuration (#1280)
Refs: https://vitejs.dev/guide/env-and-mode.html
This commit is contained in:
commit
6213628aee
5 changed files with 97 additions and 95 deletions
1
web/.gitignore
vendored
1
web/.gitignore
vendored
|
@ -8,7 +8,6 @@ node_modules/
|
|||
.vscode/
|
||||
|
||||
# Local env files
|
||||
.env
|
||||
.env*.local
|
||||
|
||||
# Next.js
|
||||
|
|
|
@ -38,8 +38,7 @@ For this (payments) web app, configure it to connect to the local museum, and
|
|||
use a set of (development) Stripe keys which can be found in [Stripe's developer
|
||||
dashboard](https://dashboard.stripe.com).
|
||||
|
||||
Add the following to
|
||||
`web/apps/payments/.env.local`
|
||||
Add the following to `web/apps/payments/.env.local`:
|
||||
|
||||
```env
|
||||
NEXT_PUBLIC_ENTE_ENDPOINT = http://localhost:8080
|
||||
|
|
87
web/apps/photos/.env
Normal file
87
web/apps/photos/.env
Normal file
|
@ -0,0 +1,87 @@
|
|||
# Sample configuration file
|
||||
#
|
||||
# All variables are commented out by default. Copy paste this into a new file
|
||||
# called `.env.local` (or create a new empty file with that name) and add the
|
||||
# environment variables you want to apply. `.env.local` is gitignored, so you
|
||||
# can freely customize it for your local setup.
|
||||
#
|
||||
# `.env.local` is picked up by Next.js when NODE_ENV is 'development' (it is
|
||||
# 'production' by default, but gets set to 'development' when we run `next
|
||||
# dev`). Here's a list of the various files that come into play:
|
||||
#
|
||||
# .env loaded in all cases
|
||||
# .env.local loaded in all cases, gitignored
|
||||
# .env.development only loaded for yarn dev
|
||||
# .env.development.local only loaded for yarn dev, gitignored
|
||||
# .env.production only loaded for yarn build
|
||||
# .env.production.local only loaded for yarn build, gitignored
|
||||
#
|
||||
# Alternatively, these variables can be provided as environment variables, say:
|
||||
#
|
||||
# NEXT_PUBLIC_ENTE_ENDPOINT=http://localhost:8080 yarn dev:photos
|
||||
#
|
||||
# Variables prefixed with NEXT_PUBLIC_ are made available when Next.js runs our
|
||||
# code in the browser (Behind the scenes, Next.js just hardcodes occurrences of
|
||||
# `process.env.NEXT_PUBLIC_FOO` with the value of the `NEXT_PUBLIC_FOO` env var
|
||||
# when the bundle is built). See
|
||||
# https://nextjs.org/docs/pages/building-your-application/configuring/environment-variables
|
||||
#
|
||||
# A development build behaves differently in some aspects:
|
||||
#
|
||||
# - Logs go to the browser console (in addition to the log file)
|
||||
# - There is some additional logging
|
||||
# - ... (search for isDevBuild to see all impacts)
|
||||
#
|
||||
# Note that even in development build, the app still connects to the production
|
||||
# APIs by default (can be customized using the env vars below). This is usually
|
||||
# a good default, for example a customer cloning this repository want to build
|
||||
# and run the client from source but still use their actual Ente account.
|
||||
|
||||
# The Ente API endpoint
|
||||
#
|
||||
# NEXT_PUBLIC_ENTE_ENDPOINT = http://localhost:3000
|
||||
|
||||
# The Ente API endpoint for accounts related functionality
|
||||
#
|
||||
# NEXT_PUBLIC_ENTE_ACCOUNTS_ENDPOINT = http://localhost:3001
|
||||
|
||||
# The Ente API endpoint for payments related functionality
|
||||
#
|
||||
# NEXT_PUBLIC_ENTE_PAYMENTS_ENDPOINT = http://localhost:3001
|
||||
|
||||
# The URL for the shared albums deployment
|
||||
#
|
||||
# The shared albums are served from the photos app code, and "albums.ente.io" is
|
||||
# a CNAME alias to the main photo app itself. When the main index page loads, it
|
||||
# checks to see if the host is "albums.ente.io", and if so, redirects to
|
||||
# /shared-albums.
|
||||
#
|
||||
# This environment variable allows us to check for a host other than
|
||||
# "albums.ente.io". By setting this to localhost:3002 and running the photos app
|
||||
# on port 3002 (using `yarn dev:albums`), we can connect to it and emulate the
|
||||
# production behaviour.
|
||||
#
|
||||
# Enhancement: Consider splitting this into a separate app/ in this repository.
|
||||
# That can also reduce bundle sizes and make it load faster.
|
||||
#
|
||||
# NEXT_PUBLIC_ENTE_ALBUMS_ENDPOINT = http://localhost:3002
|
||||
|
||||
# The URL of the family plans web app deployment
|
||||
#
|
||||
# Currently the source code for the family plan related pages is in a separate
|
||||
# repository (https://github.com/ente-io/families). The mobile app also uses
|
||||
# these pages.
|
||||
#
|
||||
# Enhancement: Consider moving that into the app/ folder in this repository.
|
||||
#
|
||||
# NEXT_PUBLIC_ENTE_FAMILY_ENDPOINT = http://localhost:3001
|
||||
|
||||
# The JSON which describes the expected results of our integration tests. See
|
||||
# `upload.test.ts` for more details of the expected format.
|
||||
#
|
||||
# This is perhaps easier to specify as an environment variable, since then we
|
||||
# can directly read from the source file when running `yarn dev`. For example,
|
||||
#
|
||||
# NEXT_PUBLIC_ENTE_TEST_EXPECTED_JSON=`cat path/to/expected.json` yarn dev
|
||||
#
|
||||
# NEXT_PUBLIC_ENTE_TEST_EXPECTED_JSON = {}
|
|
@ -1,79 +1,18 @@
|
|||
# Sample configuration file
|
||||
# Develop against a server running on localhost
|
||||
#
|
||||
# All variables are commented out by default. Copy paste this into a new file
|
||||
# called `.env.local` (or create a new empty file with that name) and add the
|
||||
# environment variables you want to apply during development. `.env.local` is
|
||||
# gitignored, so you can freely customize it for your local setup.
|
||||
# Copy this file to `.env.local` or `.env.development.local` to give you a
|
||||
# baseline setup. For more details, see `.env`,
|
||||
#
|
||||
# `.env.local` is picked up by Next.js when NODE_ENV is 'development' (it is
|
||||
# 'production' by default, but gets set to 'development' when we run `next dev`)
|
||||
#
|
||||
# Alternatively, these variables can be provided as environment variables, say:
|
||||
# Equivalent CLI command using environment variables would be
|
||||
#
|
||||
# NEXT_PUBLIC_ENTE_ENDPOINT=http://localhost:8080 yarn dev:photos
|
||||
#
|
||||
# Variables prefixed with NEXT_PUBLIC_ are made available when Next.js runs our
|
||||
# code in the browser (Behind the scenes, Next.js just hardcodes occurrences of
|
||||
# `process.env.NEXT_PUBLIC_FOO` with the value of the `NEXT_PUBLIC_FOO` env var
|
||||
# when the bundle is built). See
|
||||
# https://nextjs.org/docs/pages/building-your-application/configuring/environment-variables
|
||||
#
|
||||
# A development build behaves differently in some aspects:
|
||||
#
|
||||
# - Logs go to the browser console (in addition to the log file)
|
||||
# - There is some additional logging
|
||||
# - ... (search for isDevBuild to see all impacts)
|
||||
#
|
||||
# Note that even in development build, the app still connects to the production
|
||||
# APIs by default (can be customized using the env vars below). This is usually
|
||||
# a good default, for example a customer cloning this repository want to build
|
||||
# and run the client from source but still use their actual Ente account.
|
||||
|
||||
# The Ente API endpoint
|
||||
#
|
||||
# NEXT_PUBLIC_ENTE_ENDPOINT = http://localhost:3000
|
||||
NEXT_PUBLIC_ENTE_ENDPOINT = http://localhost:8080
|
||||
|
||||
# The Ente API endpoint for accounts related functionality
|
||||
# If you wish to preview how the shared albums work, you can use `yarn
|
||||
# dev:albums`. The equivalent CLI command using env vars would be
|
||||
#
|
||||
# NEXT_PUBLIC_ENTE_ACCOUNTS_ENDPOINT = http://localhost:3001
|
||||
# NEXT_PUBLIC_ENTE_ENDPOINT=http://localhost:8080 NEXT_PUBLIC_ENTE_ALBUMS_ENDPOINT=http://localhost:3002 yarn dev:albums
|
||||
|
||||
# The Ente API endpoint for payments related functionality
|
||||
#
|
||||
# NEXT_PUBLIC_ENTE_PAYMENTS_ENDPOINT = http://localhost:3001
|
||||
|
||||
# The URL for the shared albums deployment
|
||||
#
|
||||
# The shared albums are served from the photos app code, and "albums.ente.io" is
|
||||
# a CNAME alias to the main photo app itself. When the main index page loads, it
|
||||
# checks to see if the host is "albums.ente.io", and if so, redirects to
|
||||
# /shared-albums.
|
||||
#
|
||||
# This environment variable allows us to check for a host other than
|
||||
# "albums.ente.io". By setting this to localhost:3002 and running the photos app
|
||||
# on port 3002 (using `yarn dev:albums`), we can connect to it and emulate the
|
||||
# production behaviour.
|
||||
#
|
||||
# Enhancement: Consider splitting this into a separate app/ in this repository.
|
||||
# That can also reduce bundle sizes and make it load faster.
|
||||
#
|
||||
# NEXT_PUBLIC_ENTE_ALBUMS_ENDPOINT = http://localhost:3002
|
||||
|
||||
# The URL of the family plans web app deployment
|
||||
#
|
||||
# Currently the source code for the family plan related pages is in a separate
|
||||
# repository (https://github.com/ente-io/families). The mobile app also uses
|
||||
# these pages.
|
||||
#
|
||||
# Enhancement: Consider moving that into the app/ folder in this repository.
|
||||
#
|
||||
# NEXT_PUBLIC_ENTE_FAMILY_ENDPOINT = http://localhost:3001
|
||||
|
||||
# The JSON which describes the expected results of our integration tests. See
|
||||
# `upload.test.ts` for more details of the expected format.
|
||||
#
|
||||
# This is perhaps easier to specify as an environment variable, since then we
|
||||
# can directly read from the source file when running `yarn dev`. For example,
|
||||
#
|
||||
# NEXT_PUBLIC_ENTE_TEST_EXPECTED_JSON=`cat path/to/expected.json` yarn dev
|
||||
#
|
||||
# NEXT_PUBLIC_ENTE_TEST_EXPECTED_JSON = {}
|
||||
NEXT_PUBLIC_ENTE_ALBUMS_ENDPOINT = http://localhost:3002
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
# Develop against a server running on localhost
|
||||
#
|
||||
# Copy this file to `.env.local`. Then if you run a local instance of the web
|
||||
# client with `yarn dev:photos`, it will connect to a locally running instance
|
||||
# of the server.
|
||||
#
|
||||
# Not everything will work, you might need to set other env vars (see
|
||||
# `.env.development`), but it should give you a usable baseline setup.
|
||||
#
|
||||
# Equivalent CLI command using environment variables would be
|
||||
#
|
||||
# NEXT_PUBLIC_ENTE_ENDPOINT=http://localhost:8080 yarn dev:photos
|
||||
#
|
||||
|
||||
NEXT_PUBLIC_ENTE_ENDPOINT = http://localhost:8080
|
||||
|
||||
# If you wish to preview how the shared albums work, you can use `yarn
|
||||
# dev:albums`. The equivalent CLI command using env vars would be
|
||||
#
|
||||
# NEXT_PUBLIC_ENTE_ENDPOINT=http://localhost:8080 NEXT_PUBLIC_ENTE_ALBUMS_ENDPOINT=http://localhost:3002 yarn dev:albums
|
||||
|
||||
NEXT_PUBLIC_ENTE_ALBUMS_ENDPOINT = http://localhost:3002
|
Loading…
Add table
Reference in a new issue