我正在为客户开发应用程序。
我希望能够启动并运行,因此我将自己的API密钥用于Facebook和Google(也适用于Amazon AWS),这样他们至少可以看到它们在创建帐户之前的状态系统,所以我可以使用他们的API密钥。
现在他们已经创建了自己的帐户,我想在我的application.yaml文件中更改我的API密钥,但是当我去运行figaro heroku:set -e production
时,我收到错误:
/Users/celly/.rubies/ruby-2.2.2/lib/ruby/2.2.0/psych.rb:370:in `parse': (<unknown>): did not find expected key while parsing a block mapping at line 14 column 1 (Psych::SyntaxError)
from /Users/celly/.rubies/ruby-2.2.2/lib/ruby/2.2.0/psych.rb:370:in `parse_stream'
from /Users/celly/.rubies/ruby-2.2.2/lib/ruby/2.2.0/psych.rb:318:in `parse'
from /Users/celly/.rubies/ruby-2.2.2/lib/ruby/2.2.0/psych.rb:245:in `load'
from /Users/celly/.gem/ruby/2.2.2/gems/figaro-1.1.1/lib/figaro/application.rb:60:in `parse'
from /Users/celly/.gem/ruby/2.2.2/gems/figaro-1.1.1/lib/figaro/application.rb:56:in `block in raw_configuration'
from /Users/celly/.gem/ruby/2.2.2/gems/figaro-1.1.1/lib/figaro/application.rb:56:in `yield'
from /Users/celly/.gem/ruby/2.2.2/gems/figaro-1.1.1/lib/figaro/application.rb:56:in `raw_configuration'
from /Users/celly/.gem/ruby/2.2.2/gems/figaro-1.1.1/lib/figaro/application.rb:64:in `global_configuration'
from /Users/celly/.gem/ruby/2.2.2/gems/figaro-1.1.1/lib/figaro/application.rb:32:in `configuration'
from /Users/celly/.gem/ruby/2.2.2/gems/figaro-1.1.1/lib/figaro/cli/task.rb:19:in `configuration'
from /Users/celly/.gem/ruby/2.2.2/gems/figaro-1.1.1/lib/figaro/cli/heroku_set.rb:7:in `run'
from /Users/celly/.gem/ruby/2.2.2/gems/figaro-1.1.1/lib/figaro/cli/task.rb:9:in `run'
from /Users/celly/.gem/ruby/2.2.2/gems/figaro-1.1.1/lib/figaro/cli.rb:38:in `block in <class:CLI>'
from /Users/celly/.gem/ruby/2.2.2/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /Users/celly/.gem/ruby/2.2.2/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /Users/celly/.gem/ruby/2.2.2/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
from /Users/celly/.gem/ruby/2.2.2/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /Users/celly/.gem/ruby/2.2.2/gems/figaro-1.1.1/bin/figaro:5:in `<top (required)>'
from /Users/celly/.gem/ruby/2.2.2/bin/figaro:23:in `load'
from /Users/celly/.gem/ruby/2.2.2/bin/figaro:23:in `<main>'
我怀疑这与他们的密钥不再与以前的密钥匹配这一事实有关。
不幸的是,我在Figaro的文档中没有看到任何关于更改密钥的内容。我在搜索中看到的所有内容都必须处理正确的缩进,但我知道缩进是正确的,因为在更改密钥之前它的工作正常。
非常感谢任何帮助。
编辑:从application.yaml
# Add configuration values here, as shown below.
#
# pusher_app_id: "2954"
# pusher_key: 7381a978f7dd7f9a1117
# pusher_secret: abdc3b896a0ffb85d373
# stripe_api_key: sk_test_2J0l093xOyW72XUYJHE4Dv2r
# stripe_publishable_key: pk_test_ro9jV5SNwGb1yYlQfzG17LHK
#
# production:
# stripe_api_key: sk_live_EeHnL644i6zo4Iyq4v1KdV9H
# stripe_publishable_key: pk_live_9lcthxpSIHbGwmdO941O1XVU
# For Facebook authentication
FACEBOOK_CONSUMER_KEY: "consumer key"
FACEBOOK_CONSUMER_SECRET: "secret key"
# For Google authentication
GOOGLE_APP_ID: "app id"
GOOGLE_APP_SECRET: "secret key"
# For image upload to Amazon Web Services
AWS_BUCKET: "myafrolink"
AWS_ACCESS_KEY_ID: "access id"
AWS_SECRET_ACCESS_KEY: "secret key"
同样,我想重申,在更改密钥值之前,一切都工作正常,即使没有指定开发或生产块。
答案 0 :(得分:0)
测试了一些东西,希望它能起作用,而且确实有效。
显然,我必须从heroku中删除当前的环境变量,以便figaro可以将它们重置为新值。
heroku config:unset VARIABLE_NAME
能够成功完成此操作。一旦完成,我重新运行figaro heroku:set -e production
并且能够继续进行零错误。
我的猜测是,figaro只能设置变量。当遇到变化的变量时,它不知道该怎么做,因此通过heroku取消设置变量允许figaro将变量重置为您选择的任何值。