我正在接手一个旧的Rails应用程序。已经有一年没有人碰它了。上一个开发者在2015年4月离开,我无法联系到他。我可以通过ssh访问服务器,并且可以访问Github存储库。
我不知道任何用户名/密码。
如果我使用ssh连接到服务器并cat数据库.yml文件,我会看到类似以下内容:
staging:
adapter: mysql2
encoding: utf8
pool: 5
socket: /var/lib/mysql/mysql.sock
database: o_wawa_stage
username: wawa_stage
password: <%= ENV['STAGE_DATABASE_PASSWORD'] %>
host: access.dmedia.com
如果我运行“printenv”命令,那么我看不到这些变量。我认为它们只被Rails环境加载。
我猜我可以编辑模板以带有一堆“put”语句的方式输出值,但我认为除了在公共场合打印数据之外,还必须有更明显的方法来做到这一点?
如果我尝试运行“rails console”,我会得到:
Rails Error: Unable to access log file. Please ensure that /var/www/haha/production/releases/20150118213616/log/development.log exists and is writable (ie, make it writable for user and group: chmod 0664 /var/www/haha/production/releases/20150118213616/log/development.log). The log level has been raised to WARN and the output directed to STDERR until the problem is fixed.
我在这个系统上没有sudo权限,所以无法解决这个错误。
config.logger
的行。通常情况下,日志记录配置会在这两个文件中被覆盖。http://guides.rubyonrails.org/configuring.html也可能会有所帮助。 - Josh Deeden