简体   繁体   English

雾目录不能为空,Aws访问密钥不能为空,AWS秘密访问密钥不能为空

[英]Fog directory can't be blank, Aws access key can't be blank, Aws secret access key can't be blank

Im using asset_sync gem to upload assets to Amazon S3 bucket. 我正在使用asset_sync gem将资产上传到Amazon S3存储桶。 I used dotenv to store my keys and secret keys and deployed using capistrano to Amazon EC2. 我使用dotenv存储密钥和秘密密钥,并使用capistrano将其部署到Amazon EC2。 Everything was fine. 一切都很好。

But when I moved the keys to .bash_profile on my server and added an initializer , asset upload failed with this error. 但是,当我将密钥移到服务器上的.bash_profile并添加初始化程序时 ,资产上传失败,并显示此错误。

rake aborted!
Fog directory can't be blank, Aws access key can't be blank, Aws secret access key can't be blank

Please help me to figure out why the keys/secrets are not found. 请帮助我找出为什么找不到密钥/秘密。

Basically means you've not set the ENV vars for your shell session. 基本上意味着您没有为shell会话设置ENV变量。 I guarantee if you run rake assets:precompile FOG_DIRECTORY=[your_dir] AWS_ACCESS_KEY_ID=[your_access_key] AWS_SECRET_ACCESS_KEY=[secret_access] you'll be able to perform the operation 我保证如果您运行rake assets:precompile FOG_DIRECTORY=[your_dir] AWS_ACCESS_KEY_ID=[your_access_key] AWS_SECRET_ACCESS_KEY=[secret_access]您将能够执行该操作

The best recommendation I can give right now is to look in the /etc/environment file on your VM. 我现在能给出的最佳建议是查看您VM上的/etc/environment文件。 If you have this file, you'll be able to set the system-wide variables which will get used each time you load your app 如果您拥有此文件,则可以设置系统范围的变量,该变量在每次加载应用程序时使用

The problem is an issue between the assigning of ENVIRONMENT & SHELL variables - SHELL vars are only available in a specific shell session, whilst ENVIRONMENT vars are available throughout the system 问题是分配环境和外壳变量之间存在问题-外壳变量仅在特定的外壳程序会话中可用,而环境变量在整个系统中可用

I have not found how to declare shell-specific variables on the fly yet, by putting all the env vars inside /etc/environment it works for us 我还没有找到如何通过将所有env var放入/etc/environment来动态声明外壳特定变量的方法,它对我们有用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM