Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev: move configuration to a .env file #3430

Merged
merged 2 commits into from
Jan 11, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 24 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
VITE_UPLOADER=tus

#### To customize this, create a .env.dev.local file that overrides those values
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: it's .env.development but .env.dev.local (instead of both dev or both development)


# VITE_UPLOADER=tus
# VITE_UPLOADER=s3
# VITE_UPLOADER=s3-multipart
# xhr will use protocol 'multipart' in companion, if used with a remote service, e.g. google drive.
# If local upload will use browser XHR
# VITE_UPLOADER=xhr
# VITE_UPLOADER=transloadit
# VITE_UPLOADER=transloadit-s3
# VITE_UPLOADER=transloadit-xhr

### DEV CONFIG: Endpoint URLs

VITE_COMPANION_URL=http://localhost:3020
VITE_TUS_ENDPOINT=https://tusd.tusdemo.net/files/
VITE_XHR_ENDPOINT=https://xhr-server.herokuapp.com/upload

### DEV CONFIG: Transloadit keys
VITE_TRANSLOADIT_KEY=...
VITE_TRANSLOADIT_TEMPLATE=...
VITE_TRANSLOADIT_SERVICE_URL=https://api2.transloadit.com
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ node_modules
yarn-error.log

env.sh
*.local

dist/
lib/
Expand Down
33 changes: 11 additions & 22 deletions private/dev/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,18 @@ import DropTarget from '@uppy/drop-target'
import Audio from '@uppy/audio'
/* eslint-enable import/no-extraneous-dependencies */

// DEV CONFIG: pick an uploader
// DEV CONFIG: create a .env.development.local in the root folder to customize those values.
const {
VITE_UPLOADER : UPLOADER,
VITE_COMPANION_URL : COMPANION_URL,
VITE_TUS_ENDPOINT : TUS_ENDPOINT,
VITE_XHR_ENDPOINT : XHR_ENDPOINT,
VITE_TRANSLOADIT_KEY : TRANSLOADIT_KEY,
VITE_TRANSLOADIT_TEMPLATE : TRANSLOADIT_TEMPLATE,
VITE_TRANSLOADIT_SERVICE_URL : TRANSLOADIT_SERVICE_URL,
} = import.meta.env

const UPLOADER = 'tus'
// const UPLOADER = 's3'
// const UPLOADER = 's3-multipart'
// xhr will use protocol 'multipart' in companion, if used with a remote service, e.g. google drive.
// If local upload will use browser XHR
// const UPLOADER = 'xhr'
// const UPLOADER = 'transloadit'
// const UPLOADER = 'transloadit-s3'
// const UPLOADER = 'transloadit-xhr'

// DEV CONFIG: Endpoint URLs

const COMPANION_URL = 'http://localhost:3020'
const TUS_ENDPOINT = 'https://tusd.tusdemo.net/files/'
const XHR_ENDPOINT = 'https://xhr-server.herokuapp.com/upload'

// DEV CONFIG: Transloadit keys

const TRANSLOADIT_KEY = '...'
const TRANSLOADIT_TEMPLATE = '...'
const TRANSLOADIT_SERVICE_URL = 'https://api2.transloadit.com'
console.log(import.meta.env)

// DEV CONFIG: enable or disable Golden Retriever

Expand Down
9 changes: 8 additions & 1 deletion private/dev/DragDrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ import DragDrop from '@uppy/drag-drop'
import ProgressBar from '@uppy/progress-bar'
/* eslint-enable import/no-extraneous-dependencies */

// DEV CONFIG: create a .env.development.local in the root folder to customize those values.
const {
VITE_TUS_ENDPOINT : TUS_ENDPOINT,
} = import.meta.env

console.log(import.meta.env)

export default () => {
const uppyDragDrop = new Uppy({
debug: true,
Expand All @@ -15,7 +22,7 @@ export default () => {
target: '#uppyDragDrop',
})
.use(ProgressBar, { target: '#uppyDragDrop-progress', hideAfterFinish: false })
.use(Tus, { endpoint: 'https://tusd.tusdemo.net/files/' })
.use(Tus, { endpoint: TUS_ENDPOINT })

window.uppy = uppyDragDrop

Expand Down
1 change: 1 addition & 0 deletions private/dev/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const config = {
defaultIsModuleExports: true,
},
},
envDir: fileURLToPath(ROOT),
esbuild: {
jsxFactory: 'h',
jsxFragment: 'Fragment',
Expand Down