aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authoryuuji.yaginuma <yuuji.yaginuma@gmail.com>2017-07-13 08:06:32 +0900
committeryuuji.yaginuma <yuuji.yaginuma@gmail.com>2017-07-13 08:06:32 +0900
commit1677c64ee0929085c72467468b7c2e87554a80ba (patch)
treea8fa124ab656f5070615c234e4db5436c196e63e /railties
parent58f10a31b37e9bb6e975a71aa63744f318ee043d (diff)
downloadrails-1677c64ee0929085c72467468b7c2e87554a80ba.tar.gz
rails-1677c64ee0929085c72467468b7c2e87554a80ba.tar.bz2
rails-1677c64ee0929085c72467468b7c2e87554a80ba.zip
Allow to edit secrets in mutiple apps at the same time
In encrypted secrets, the tmp file is used as a fixed file (`secrets.yml.enc` under the tmp directory). And that tmp file will be removed after process. Therefore, if edit secrets at the same time with multiple applications, the tmp file was conflicting. In order to avoid the above issue, added pid to tmp file.
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/secrets.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/railties/lib/rails/secrets.rb b/railties/lib/rails/secrets.rb
index 46e21185d7..0883857c55 100644
--- a/railties/lib/rails/secrets.rb
+++ b/railties/lib/rails/secrets.rb
@@ -100,7 +100,8 @@ module Rails
end
def writing(contents)
- tmp_path = File.join(Dir.tmpdir, File.basename(path))
+ tmp_file = "#{File.basename(path)}.#{Process.pid}"
+ tmp_path = File.join(Dir.tmpdir, tmp_file)
IO.binwrite(tmp_path, contents)
yield tmp_path