Last active
February 25, 2019 21:49
-
-
Save vovimayhem/ccf6f3057b42bdf110c8b321bc7ea7c3 to your computer and use it in GitHub Desktop.
Changes to common rails wrapper script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# This file is located at `bin/rails` | |
# Load the 'switch_user_and_exec' routine: | |
require_relative '../config/switch_user_and_exec' | |
begin | |
load File.expand_path('../spring', __FILE__) | |
rescue LoadError => e | |
raise unless e.message.include?('spring') | |
end | |
APP_PATH = File.expand_path('../config/application', __dir__) | |
require_relative '../config/boot' | |
require 'rails/commands' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file is located at `config/switch_user_and_exec.rb` | |
require 'etc' | |
info = Etc.getpwuid | |
if info.name == 'root' && (target_user = ENV['DEVELOPER_USER']) | |
puts "Switching from 'root' user to '#{target_user}'..." | |
exec 'su-exec', target_user, $0, *$* | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment