This repository was archived by the owner on Aug 21, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +25
-3
lines changed
packages/server-core/src/media/storageprovider Expand file tree Collapse file tree 1 file changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ import { MULTIPART_CUTOFF_SIZE } from '@etherealengine/common/src/constants/File
34
34
35
35
import { FileBrowserContentType } from '@etherealengine/engine/src/schemas/media/file-browser.schema'
36
36
import { getState } from '@etherealengine/hyperflux'
37
+ import { ChildProcess } from 'child_process'
37
38
import logger from '../../ServerLogger'
38
39
import { ServerMode , ServerState } from '../../ServerState'
39
40
import config from '../../appconfig'
@@ -81,9 +82,30 @@ export class LocalStorage implements StorageProviderInterface {
81
82
this . _store = fsStore ( this . PATH_PREFIX )
82
83
83
84
if ( getState ( ServerState ) . serverMode === ServerMode . API && ! config . testEnabled ) {
84
- require ( 'child_process' ) . spawn ( 'npm' , [ 'run' , 'serve-local-files' ] , {
85
- cwd : process . cwd ( ) ,
86
- stdio : 'inherit'
85
+ const child : ChildProcess = require ( 'child_process' ) . spawn (
86
+ 'npx' ,
87
+ [
88
+ 'http-server' ,
89
+ `${ this . PATH_PREFIX } ` ,
90
+ '--ssl' ,
91
+ '--cert' ,
92
+ `${ config . server . certPath } ` ,
93
+ '--key' ,
94
+ `${ config . server . keyPath } ` ,
95
+ '--port' ,
96
+ '8642' ,
97
+ '--cors=*' ,
98
+ '--brotli' ,
99
+ '--gzip'
100
+ ] ,
101
+ {
102
+ cwd : process . cwd ( ) ,
103
+ stdio : 'inherit' ,
104
+ detached : true
105
+ }
106
+ )
107
+ process . on ( 'exit' , async ( ) => {
108
+ process . kill ( - child . pid ! , 'SIGINT' )
87
109
} )
88
110
}
89
111
this . getOriginURLs ( ) . then ( ( result ) => ( this . originURLs = result ) )
You can’t perform that action at this time.
0 commit comments