feat: add resolve absolute path util (#5836)
Add a new util called `resolveAbsolutePath` to allow providing absolute path for environment variable like `STORAGE_LOCAL_PATH`. If the path in the env start with `/` we'll not prefix it with `process.cwd()`. Also we're using a static path for the old `db_initialized` file now named `db_status` and stop using the env variable for this file as this one shouldn't ne stored in the `STORAGE_LOCAL_PATH`. Fix #4794 --------- Co-authored-by: Quentin Galliano <qgalliano@gmail.com>
This commit is contained in:
@ -5,6 +5,7 @@ import {
|
||||
FileStorageModuleOptions,
|
||||
StorageDriverType,
|
||||
} from 'src/engine/integrations/file-storage/interfaces';
|
||||
import { resolveAbsolutePath } from 'src/utils/resolve-absolute-path';
|
||||
|
||||
/**
|
||||
* FileStorage Module factory
|
||||
@ -23,7 +24,7 @@ export const fileStorageModuleFactory = async (
|
||||
return {
|
||||
type: StorageDriverType.Local,
|
||||
options: {
|
||||
storagePath: process.cwd() + '/' + storagePath,
|
||||
storagePath: resolveAbsolutePath(storagePath),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user