Fix env loading

This commit is contained in:
Jeremie Pardou-Piquemal 2022-12-29 23:55:14 +01:00 committed by Jérémie Pardou-Piquemal
parent d2846e1605
commit 6d0b703102
7 changed files with 15 additions and 19 deletions

View File

@ -10,10 +10,6 @@ fi
echo "building client..."
cd client
yarn --production=false
VITE_COMMIT_SHA=$SOURCE_VERSION \
VITE_API_HOST=$api_host \
VITE_API_PROTOCOL=$API_PROTOCOL \
VITE_API_PORT=$API_PORT \
yarn build
cd ../

View File

@ -3,7 +3,7 @@ let host;
let protocol;
let port;
switch (import.meta.env.NODE_ENV) {
switch (import.meta.env.MODE) {
case 'staging':
host = import.meta.env.VITE_API_HOST;
protocol = import.meta.env.VITE_API_PROTOCOL || 'https';

View File

@ -12,7 +12,6 @@ import 'bootstrap/dist/js/bootstrap.bundle.min.js';
import configureStore from '@/store/';
import Home from '@/components/Home/';
import { hasTouchSupport } from '@/utils/dom';
import { AlertTriangle } from 'react-feather';
const store = configureStore();
@ -44,13 +43,14 @@ const Main = () => {
);
};
const root = createRoot(document.getElementById('root') as HTMLElement);
if (!window.crypto || !window.crypto.subtle) {
window.alert("You must access Darkwire from a secure HTTPS connection.")
throw new Error("You must access Darkwire from a secure HTTPS connection.")
}
const root = createRoot(document.getElementById('root') as HTMLElement);
root.render(
<React.StrictMode>
<Main />

View File

@ -7,16 +7,16 @@ set -e
echo "
TZ=UTC
REACT_APP_API_HOST=$REACT_APP_API_HOST
REACT_APP_API_PROTOCOL=$REACT_APP_API_PROTOCOL
REACT_APP_API_PORT=$REACT_APP_API_PORT
REACT_APP_COMMIT_SHA=$REACT_APP_COMMIT_SHA
VITE_API_HOST=$VITE_API_HOST
VITE_API_PROTOCOL=$VITE_API_PROTOCOL
VITE_API_PORT=$VITE_API_PORT
VITE_COMMIT_SHA=$VITE_COMMIT_SHA
# To display darkwire version
REACT_APP_COMMIT_SHA=$REACT_APP_COMMIT_SHA
VITE_COMMIT_SHA=$VITE_COMMIT_SHA
# Set max transferable file size in MB
REACT_APP_MAX_FILE_SIZE=$REACT_APP_MAX_FILE_SIZE
VITE_MAX_FILE_SIZE=$VITE_MAX_FILE_SIZE
" > client/.env
@ -26,7 +26,7 @@ MAILGUN_DOMAIN=$MAILGUN_DOMAIN
ABUSE_TO_EMAIL_ADDRESS=$ABUSE_TO_EMAIL_ADDRESS
ABUSE_FROM_EMAIL_ADDRESS=$ABUSE_FROM_EMAIL_ADDRESS
CLIENT_DIST_DIRECTORY='client/dist/path'
CLIENT_DIST_DIRECTORY='client/dist/'
ROOM_HASH_SECRET=$ROOM_HASH_SECRET

View File

@ -30,9 +30,9 @@ API which is accessible only on localhost and behind a https connection.
You can use nvm to install the right version of node using this command:
```
nvm install # If not already installed
nvm install # If the right node version is not already installed
nvm use
npm install yarn -g
npm install yarn -g # To install yarn
```
Install dependencies

View File

@ -4,7 +4,7 @@ MAILGUN_DOMAIN=darkwire.io
ABUSE_TO_EMAIL_ADDRESS=abuse@darkwire.io
ABUSE_FROM_EMAIL_ADDRESS=Darkwire <no-reply@darkwire.io>
CLIENT_DIST_DIRECTORY='client/dist/path'
CLIENT_DIST_DIRECTORY='client/dist'
ROOM_HASH_SECRET='some-uuid'

View File

@ -385,7 +385,7 @@ rxjs@^6.5.2:
dependencies:
tslib "^1.9.0"
semver@^5.5.0, "semver@2 || 3 || 4 || 5":
"semver@2 || 3 || 4 || 5", semver@^5.5.0:
version "5.7.1"
resolved "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz"
integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==