我根据 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 is undefined
最佳答案
如果你想访问客户端上的变量,你必须将变量放在public
部分
关于javascript - Meteor 无法从 json 文件加载设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44456299/