Class: PhusionPassenger::Standalone::ConfigFile

Inherits:
Object
  • Object
show all
Defined in:
lib/phusion_passenger/standalone/config_file.rb

Defined Under Namespace

Classes: DisallowedContextError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context, filename) ⇒ ConfigFile



42
43
44
45
46
47
48
49
50
# File 'lib/phusion_passenger/standalone/config_file.rb', line 42

def initialize(context, filename)
	@options  = {}
	@context  = context
	@filename = filename
	File.open(filename, 'r') do |f|
		f.flock(File::LOCK_SH)
		instance_eval(f.read, filename)
	end
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options



40
41
42
# File 'lib/phusion_passenger/standalone/config_file.rb', line 40

def options
  @options
end

Instance Method Details

#address(addr) ⇒ Object



52
53
54
55
56
# File 'lib/phusion_passenger/standalone/config_file.rb', line 52

def address(addr)
	allowed_contexts(:port, :global_config)
	@options[:address] = addr
	@options[:tcp_explicitly_given] = true
end

#analytics(value) ⇒ Object



101
102
103
# File 'lib/phusion_passenger/standalone/config_file.rb', line 101

def analytics(value)
	@options[:analytics] = value
end

#daemonize(on) ⇒ Object



81
82
83
84
# File 'lib/phusion_passenger/standalone/config_file.rb', line 81

def daemonize(on)
	allowed_contexts(:daemonize, :global_config)
	@options[:daemonize] = on
end

#debugger(value) ⇒ Object



105
106
107
# File 'lib/phusion_passenger/standalone/config_file.rb', line 105

def debugger(value)
	@options[:debugger] = value
end

#domain_name(name) ⇒ Object



91
92
93
94
# File 'lib/phusion_passenger/standalone/config_file.rb', line 91

def domain_name(name)
	allowed_contexts(:domain_name, :local_config)
	@options[:server_names] = [name]
end

#domain_names(*names) ⇒ Object



96
97
98
99
# File 'lib/phusion_passenger/standalone/config_file.rb', line 96

def domain_names(*names)
	allowed_contexts(:domain_names, :local_config)
	@options[:server_names] = names.to_a.flatten
end

#environment(name) ⇒ Object Also known as: env, rails_env, rack_env



64
65
66
# File 'lib/phusion_passenger/standalone/config_file.rb', line 64

def environment(name)
	@options[:env] = name
end

#max_pool_size(number) ⇒ Object



72
73
74
75
# File 'lib/phusion_passenger/standalone/config_file.rb', line 72

def max_pool_size(number)
	allowed_contexts(:max_pool_size, :global_config)
	@options[:max_pool_size] = number
end

#min_instances(number) ⇒ Object



77
78
79
# File 'lib/phusion_passenger/standalone/config_file.rb', line 77

def min_instances(number)
	@options[:min_instances] = number
end

#nginx_bin(filename) ⇒ Object



86
87
88
89
# File 'lib/phusion_passenger/standalone/config_file.rb', line 86

def nginx_bin(filename)
	allowed_contexts(:nginx_bin, :global_config)
	@options[:nginx_bin] = filename
end

#port(number) ⇒ Object



58
59
60
61
62
# File 'lib/phusion_passenger/standalone/config_file.rb', line 58

def port(number)
	allowed_contexts(:port, :global_config)
	@options[:port] = number
	@options[:tcp_explicitly_given] = true
end