lib/faastruby/cli.rb in faastruby-0.5.25 vs lib/faastruby/cli.rb in faastruby-0.5.26
- old
+ new
@@ -62,19 +62,25 @@
def self.start_server(args)
parsed = []
parsed << 'FAASTRUBY_PROJECT_SYNC_ENABLED=true' if args.delete('--sync')
parsed << 'DEBUG=true' if args.delete('--debug')
+ server_port = '3000'
+
args.each_with_index do |arg, i|
if ['--env', '-e'].include?(arg)
args.delete_at(i)
parsed << "FAASTRUBY_PROJECT_DEPLOY_ENVIRONMENT=#{args.delete_at(i)}"
+ else ['-p', '--port'].include?(arg)
+ args.delete_at(i)
+ server_port = args.delete_at(i)
end
end
+ parsed << "SERVER_PORT=#{server_port}"
server_dir = "#{Gem::Specification.find_by_name("faastruby").gem_dir}/lib/faastruby/server"
config_ru = "#{server_dir}/config.ru"
puma_config = "#{server_dir}/puma.rb"
- exec "#{parsed.join(' ')} puma -C #{puma_config} #{args.join(' ')} #{config_ru}"
+ exec "#{parsed.join(' ')} puma -C #{puma_config} -p #{server_port} #{args.join(' ')} #{config_ru}"
end
def self.start_tmuxinator
if system("tmux -V > /dev/null")
project_name = YAML.load(File.read("project.yml"))['name']
exec("tmuxinator start #{project_name} -p tmuxinator.yml")