From 1677c64ee0929085c72467468b7c2e87554a80ba Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Thu, 13 Jul 2017 08:06:32 +0900 Subject: 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. --- railties/lib/rails/secrets.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'railties') 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 -- cgit v1.2.3