Change how ruby executes commands

This commit is contained in:
spengreb 2019-10-08 22:07:00 +02:00
parent 359656bdd6
commit f2738686d5

View file

@ -5,7 +5,7 @@ class VouchersController < ApplicationController
# GET /vouchers
def index
@vouchers = Voucher.all
whitelist = %x(mcrcon -c -H mine.vereto.net -p #{ENV["MC_RCON_PASS"]} 'whitelist list' | sed 's/There are*.*whitelisted players: //g').gsub("\n", "").split(", ")
whitelist = %x[mcrcon -c -H mine.vereto.net -p #{ENV["MC_RCON_PASS"]} 'whitelist list' | sed 's/There are*.*whitelisted players: //g'].gsub("\n", "").split(", ")
render json: { :vouchers => @vouchers, :whitelist => whitelist }.to_json
end