0

我正在为客户开发一个应用程序。

我希望能够启动并运行它,所以我为 Facebook 和 Google(也为 Amazon AWS)使用了我自己的 API 密钥,这样他们至少可以在他们在相同的系统上创建帐户之前看到它的外观,所以我可以使用他们的 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"

再次,我想重申,在我更改键的值之前,一切都工作得很好,即使没有指定开发或生产块。

4

1 回答 1

0

测试了一些东西,希望它会起作用,它确实做到了。

显然,我必须从 heroku 中删除当前的环境变量,以便 figaro 可以将它们重置为新值。

heroku config:unset VARIABLE_NAME能够成功地做到这一点。完成后,我重新运行figaro heroku:set -e production并能够以零错误继续进行。

我的猜测是 figaro 只能设置变量。当它遇到一个已更改的变量时,它不知道该怎么做,因此通过 heroku 取消设置变量允许 figaro 将变量重置为您选择的任何值。

于 2015-05-25T00:36:49.627 回答