Skip to content
This repository was archived by the owner on Jan 22, 2021. It is now read-only.

Commit 232b480

Browse files
committed
Merge pull request #17 from ChromaPDX/master
Read template dir from the APP_DIR environment variable, if exists.
2 parents ed5637b + 87a60ef commit 232b480

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

README.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -173,17 +173,14 @@ Mailer.send(
173173

174174
Simple as a pie!
175175

176-
#### Important note regarding template paths
177-
178-
**tldr;** Set the `BUNDLE_PATH` environment variable to the absolute path to your Meteor app bundle directory.
176+
### Template paths on deployed instances
179177

180178
This package assumes that assets (templates, SCSS, CSS ..) are stored in the `private` directory. Thanks to that, Meteor won't touch the HTML and CSS, which are non-JS files. Unfortunately, Meteor packages can't access content in `private` with the `Assets.getText()` method, so we need the *absolute path* to the template directory.
181179

182-
However, since the file paths are screwed up when bundling and deploying Meteor apps, we need to set the `BUNDLE_PATH` env var to keep track of where the bundle lives. When deployed, set the `BUNDLE_PATH` env var to the location, perhaps:
180+
However, file paths are screwed up when bundling and deploying Meteor apps. Therefore, when running a deployed instance, **one of the following variables must return the absolute path to the bundle...**
183181

184-
```
185-
/var/www/app/bundle
186-
```
182+
1. For traditional hosts, manually set the `BUNDLE_PATH` environment variable. example: `/var/www/app/bundle`
183+
2. For deployments on hosts with ephemeral file systems like Modulus, the `process.env.APP_DIR` variable should be provided by host
187184

188185
### Template Helpers
189186

utils.coffee

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@ sass = Npm.require 'node-sass'
1414
#
1515
# When deployed, set the BUNDLE_PATH env var to the location, perhaps:
1616
# /var/www/app/bundle
17+
# For Modulus, you need to use the APP_DIR variable, which you do NOT need to set
18+
1719
if process.env.BUNDLE_PATH
1820
ROOT = path.join(process.env.BUNDLE_PATH, 'programs', 'server', 'assets', 'app')
21+
else if process.env.APP_DIR
22+
ROOT = path.join(process.env.APP_DIR, 'programs','server', 'assets', 'app')
1923
else
2024
# In development, using PWD is fine.
2125
ROOT = path.join(process.env.PWD, 'private')

0 commit comments

Comments
 (0)