Module: PgBouncerHero
- Extended by:
- Forwardable
- Defined in:
- lib/pgbouncerhero.rb,
lib/pgbouncerhero/group.rb,
lib/pgbouncerhero/engine.rb,
lib/pgbouncerhero/version.rb,
lib/pgbouncerhero/database.rb,
lib/pgbouncerhero/connection.rb,
lib/pgbouncerhero/methods/basics.rb,
lib/generators/pgbouncerhero/config_generator.rb,
app/helpers/pg_bouncer_hero/application_helper.rb,
app/controllers/pg_bouncer_hero/home_controller.rb,
app/controllers/pg_bouncer_hero/database_controller.rb,
app/controllers/pg_bouncer_hero/application_controller.rb
Defined Under Namespace
Modules: ApplicationHelper, Generators, Methods
Classes: ApplicationController, Connection, Database, DatabaseController, Engine, Group, HomeController
Constant Summary
collapse
- VERSION =
"2.0.0"
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.env ⇒ Object
Returns the value of attribute env.
19
20
21
|
# File 'lib/pgbouncerhero.rb', line 19
def env
@env
end
|
Class Method Details
.config ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/pgbouncerhero.rb', line 34
def config
Thread.current[:PgBouncerHero_config] ||= begin
path = "config/pgbouncerhero.yml"
config = YAML.load(ERB.new(File.read(path)).result) if File.exist?(path)
config ||= {}
if config[env]
config[env]
elsif config["pgbouncers"]
config
else
{
"pgbouncers" => {
"default" => {
"primary" => {
"url" => ENV["PGBOUNCERHERO_DATABASE_URL"]
}
}
}
}
end
end
end
|
.groups ⇒ Object
59
60
61
62
63
64
65
66
|
# File 'lib/pgbouncerhero.rb', line 59
def groups
@groups ||= begin
mapped = config['pgbouncers'].map do |group_id, hash|
[group_id.parameterize, PgBouncerHero::Group.new(group_id, config['pgbouncers'])]
end
Hash[mapped]
end
end
|
.time_zone ⇒ Object
30
31
32
|
# File 'lib/pgbouncerhero.rb', line 30
def time_zone
@time_zone || Time.zone
end
|
.time_zone=(time_zone) ⇒ Object
26
27
28
|
# File 'lib/pgbouncerhero.rb', line 26
def time_zone=(time_zone)
@time_zone = time_zone.is_a?(ActiveSupport::TimeZone) ? time_zone : ActiveSupport::TimeZone[time_zone.to_s]
end
|