Javascript 流星可以';t从json文件加载设置
我基于以下内容创建了以下Javascript 流星可以';t从json文件加载设置,javascript,json,meteor,ecmascript-6,Javascript,Json,Meteor,Ecmascript 6,我基于以下内容创建了以下settings.json文件: { "azure":{ "container":"The container to store the data", "account":"The account name", "key":"The key that is used for authentication" } } import { Meteor } from 'meteor/meteor'; export const
settings.json
文件:
{
"azure":{
"container":"The container to store the data",
"account":"The account name",
"key":"The key that is used for authentication"
}
}
import { Meteor } from 'meteor/meteor';
export const FileUploadSettings= {
'container': Meteor.settings.azure.container,
'account': Meteor.settings.azure.account,
'key': Meteor.settings.azure.key
}
我还创建了一个名为imports/settings/fileUploadSettings.js的文件,该文件包含以下内容:
{
"azure":{
"container":"The container to store the data",
"account":"The account name",
"key":"The key that is used for authentication"
}
}
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
但是当我访问时,我得到以下错误:
TypeError:Meteor.settings.azure未定义
如果要访问客户端上的变量,必须将变量放置在public
部分如果要访问客户端上的变量,必须将变量放置在public
部分是否尝试了meteor--settings settings.json
?如果要访问客户端上的变量,您必须将变量放入public
section@none最后,这就是答案。请在下面提交。您是否尝试过meteor--settings settings.json
?如果您想访问客户端上的变量,您必须将变量放置在public
section@none最后,这就是答案。请在下面提交。