Files
sharp-coin/lib/sharp-coin/config.rb
Nick Thomas 31ec01797f Massive-ish in-place commit.
Start of database, wire protocol specification
2011-05-15 23:32:50 +01:00

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