bbpress.rb: move configuration to ENV

This commit is contained in:
Jay Pfaffman 2016-09-26 15:03:42 -07:00
parent d69cf820d8
commit 1c0e5ce523
1 changed files with 13 additions and 2 deletions

View File

@ -1,18 +1,29 @@
require 'mysql2' require 'mysql2'
require File.expand_path(File.dirname(__FILE__) + "/base.rb") require File.expand_path(File.dirname(__FILE__) + "/base.rb")
# Before running this script, paste these lines into your shell,
# then use arrow keys to edit the values
=begin
export BBPRESS_USER="root"
export BBPRESS_DB="bbpress"
export BBPRESS_PW=""
=end
class ImportScripts::Bbpress < ImportScripts::Base class ImportScripts::Bbpress < ImportScripts::Base
BB_PRESS_DB ||= ENV['BBPRESS_DB'] || "bbpress" BB_PRESS_DB ||= ENV['BBPRESS_DB'] || "bbpress"
BATCH_SIZE ||= 1000 BATCH_SIZE ||= 1000
BB_PRESS_PW ||= ENV['BBPRESS_PW'] || ""
BB_PRESS_USER ||= ENV['BBPRESS_USER'] || "root"
def initialize def initialize
super super
@client = Mysql2::Client.new( @client = Mysql2::Client.new(
host: "localhost", host: "localhost",
username: "root", username: BB_PRESS_USER,
database: BB_PRESS_DB, database: BB_PRESS_DB,
password: BB_PRESS_PW,
) )
end end