Merge pull request #4465 from pfaffman/bbpress-env-config
bbpress.rb: move configuration to ENV
This commit is contained in:
commit
11fdb8f038
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue