【发布时间】:2017-06-09 11:10:30
【问题描述】:
我基于this site创建了以下settings.json文件,内容如下:
{
"azure":{
"container":"The container to store the data",
"account":"The account name",
"key":"The key that is used for authentication"
}
}
我还创建了一个名为imports/settings/fileUploadSettings.js 的文件,其内容如下:
import { Meteor } from 'meteor/meteor';
export const FileUploadSettings= {
'container': Meteor.settings.azure.container,
'account': Meteor.settings.azure.account,
'key': Meteor.settings.azure.key
}
然后我用命令运行它:
meteor --settings=./settings.json
但是当我访问http://localhost:3000 时,我收到以下错误:
TypeError: Meteor.settings.azure 未定义
【问题讨论】:
-
你试过
meteor --settings settings.json吗? -
如果你想在客户端访问变量,你必须将变量放在
public部分 -
@none 最后这就是答案。请在下面提交。
标签: javascript json meteor ecmascript-6