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

Default to not clone static resources on local dev #7827

Merged
merged 1 commit into from
Mar 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.local.default
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ LOCAL_STORAGE_PROVIDER_PORT=8642
GOOGLE_ANALYTICS_TRACKING_ID=
HUB_ENDPOINT=https://etherealengine.io
INSTANCESERVER_UNREACHABLE_TIMEOUT_SECONDS=10

CLONE_STATIC_RESOURCES=false


MATCHMAKER_EMULATION_MODE=true
Expand Down
2 changes: 2 additions & 0 deletions packages/server-core/src/appconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ const server = {
localStorageProviderPort: process.env.LOCAL_STORAGE_PROVIDER_PORT!,
corsServerPort: process.env.CORS_SERVER_PORT!,
storageProvider: process.env.STORAGE_PROVIDER!,
cloneProjectStaticResources:
typeof process.env.CLONE_STATIC_RESOURCES === 'undefined' ? true : process.env.CLONE_STATIC_RESOURCES === 'true',
gaTrackingId: process.env.GOOGLE_ANALYTICS_TRACKING_ID!,
hub: {
endpoint: process.env.HUB_ENDPOINT!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Readable } from 'stream'
import { AudioInterface } from '@etherealengine/common/src/dbmodels/Audio'

import { Application } from '../../../declarations'
import config from '../../appconfig'
import logger from '../../ServerLogger'
import { uploadMediaStaticResource } from '../static-resource/static-resource-helper'

Expand Down Expand Up @@ -96,7 +97,7 @@ export const audioUpload = async (app: Application, data) => {
})
}

if (existingResource && existingAudio) return existingAudio
if (!config.server.cloneProjectStaticResources || (existingResource && existingAudio)) return existingAudio
else {
let file, body
if (data.url) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Op } from 'sequelize'
import { Readable } from 'stream'

import { Application } from '../../../declarations'
import config from '../../appconfig'
import logger from '../../ServerLogger'
import { uploadMediaStaticResource } from '../static-resource/static-resource-helper'

Expand Down Expand Up @@ -77,7 +78,8 @@ export const imageUpload = async (app: Application, data) => {
]
}
})
if (existingResource && existingImage) return app.service('image').get(existingImage.id)
if (!config.server.cloneProjectStaticResources || (existingResource && existingImage))
return app.service('image').get(existingImage.id)
else {
let file, body
if (data.url) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Readable } from 'stream'
import { CommonKnownContentTypes } from '@etherealengine/common/src/utils/CommonKnownContentTypes'

import { Application } from '../../../declarations'
import config from '../../appconfig'
import logger from '../../ServerLogger'
import { addGenericAssetToS3AndStaticResources } from '../upload-asset/upload-asset.service'

Expand Down Expand Up @@ -77,7 +78,8 @@ export const modelUpload = async (app: Application, data) => {
]
}
})
if (existingResource && existingModel) return app.service('model').get(existingModel.id)
if (!config.server.cloneProjectStaticResources || (existingResource && existingModel))
return app.service('model').get(existingModel.id)
else {
let file, body
if (data.url) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Op } from 'sequelize'
import { Readable } from 'stream'

import { Application } from '../../../declarations'
import config from '../../appconfig'
import logger from '../../ServerLogger'
import { uploadMediaStaticResource } from '../static-resource/static-resource-helper'

Expand Down Expand Up @@ -85,7 +86,7 @@ export const videoUpload = async (app: Application, data, parentId?: string, par
include
})
}
if (existingResource && existingVideo) return existingVideo
if (!config.server.cloneProjectStaticResources || (existingResource && existingVideo)) return existingVideo
else {
let file, body
if (data.url) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import fetch from 'node-fetch'
import { Op } from 'sequelize'

import { Application } from '../../../declarations'
import config from '../../appconfig'
import logger from '../../ServerLogger'
import { addGenericAssetToS3AndStaticResources } from '../upload-asset/upload-asset.service'
import { videoUpload } from '../video/video-upload.helper'
Expand Down Expand Up @@ -41,7 +42,7 @@ const handleManifest = async (app: Application, url: string, name = 'untitled',
]
})
}
if (existingResource && existingData) return existingData
if (!config.server.cloneProjectStaticResources || (existingResource && existingData)) return existingData
else {
if (!existingResource) {
let file, body
Expand Down