storagePath setting by environment
See original GitHub issueIs there a way to configure the storagePath per environment? I mean, I know there are lots of ways, but was wondering which is considered a good way to do it.
In my dev environment I use:
storagePath: Meteor.absolutePath + '/../data/attachments',
so my ‘data’ directory is one level ‘above’ my meteor project directory
For example, in dev I have:
[my app dir]/data -> file storage for various files collections [my app dir]/App -> meteor app (public, imports, etc)
When I deploy to my staging env,(or production for that matter) the build directories are a little ‘deeper’, so the relative path for my storage ends up ‘lower’ in my build tree. I’d like it to be consistent across environments.
Example of what I have now: [my app dir]/bundle (where I install the built program) [my app dir]/bundle/programs/server (what Meteor.absolutePath points to) [my app dir]/bundle/programs/data (where my file collections data ends up) [my app dir]/bundle/programs [my app dir]/repo (for pulling code and building)
I would like to still have [my app dir]/data in my staging and prod environments too if possible.
Thanks in advance for any advice.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)

Top Related StackOverflow Question
Or: … storagePath: Meteor.isDevelopment ?
${Meteor. absolutePath}/aDevPath:${Meteor. absolutePath}/aProdPathNo need to open this back up, I’m just commenting in case anyone stumbles across this. Apologies if I misunderstood your suggestion, but I was already using the meteor-root package. The issue is that the the output from absolutePath and rootPath are quite different between meteor in development mode and meteor in production mode.
I was able to fix my particular issue however by doing this:
var filesPath; if(Meteor.isDevelopment) { filesPath = Meteor.absolutePath + ‘/…/data/files’; } else { filesPath = Meteor.absolutePath + ‘/…/…/…/…/files/meteor/files’; }
and then:
export const Files = new FilesCollection({ //debug: true, debug: false, collectionName: ‘Files’, allowClientCode: false, // Disallow remove files from Client storagePath: filesPath, …
That way, in Production mode, my files location is outside the bundle directory that is built for production.