如何在Heroku上动态设置phantomJS命令行选项

时间:2013-12-03 16:44:37

标签: heroku phantomjs

我在heroku上运行了一个phantomjs应用程序。我需要能够设置几个通常由命令行(https://github.com/ariya/phantomjs/wiki/API-Reference)访问的命令,最好是在运行时,但如果需要,每天一次。

我想将heroku procfile设置为:

phantomjs --config=/path/to/config.json somescript.js

config.json看起来像

{
/* Same as: --ignore-ssl-errors=true */
"ignoreSslErrors": true,

/* Same as: --max-disk-cache-size=1000 */
"maxDiskCacheSize": 1000,

/* Same as: --output-encoding=utf8 */
"outputEncoding": "utf8"

/* etc. */
}

我的想法是我想在运行我的phantomjs应用程序之前将json对象上传到heroku短暂文件系统。我希望它运行时会使用更新的配置文件。这看起来合情合理吗?有人试过这样的事吗?

1 个答案:

答案 0 :(得分:1)

我会通过

设置一个变量
heroku config:set NAME=VALUE

在运行时读取,因此您可以随时更改它。

如果您需要更频繁地更改配置变量,也可以通过其API https://devcenter.heroku.com/articles/platform-api-reference#config-var更新配置变量。

相关问题