60 lines
1.2 KiB
Ruby
60 lines
1.2 KiB
Ruby
require 'yaml'
|
|
require 'blankslate'
|
|
|
|
module SharpCoin
|
|
# Parses the sharp-coin.config.yaml file and provides access to all its
|
|
# settings in one place. This is a singleton.
|
|
# @author Nick Thomas <nick@lupine.me.uk>
|
|
class Config < BlankSlate
|
|
def initialize
|
|
raise ArgumentError.new("Singleton class!")
|
|
end
|
|
|
|
class << self
|
|
|
|
# Load the configuration file into memory.
|
|
# @param[String] filename Configuration file
|
|
# @return[SharpCoin::Config] self
|
|
def read(filename)
|
|
@config = YAML::parse_file(filename)
|
|
end
|
|
|
|
def http_host
|
|
"localhost"
|
|
end
|
|
|
|
def http_port
|
|
3000
|
|
end
|
|
|
|
# @return[Array<String,Fixnum>] Address and port that the HTTP server
|
|
# should bind to.
|
|
def http_bind
|
|
[http_host, http_port]
|
|
end
|
|
|
|
def telnet_host
|
|
"localhost"
|
|
end
|
|
|
|
def telnet_port
|
|
3001
|
|
end
|
|
|
|
def telnet_bind
|
|
[telnet_host, telnet_port]
|
|
end
|
|
|
|
def db_settings
|
|
{ :adapter => 'sqlite', :database => 'sharp-coin.sqlite' }
|
|
end
|
|
|
|
def db_automigrate?
|
|
true
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
end
|