-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable database encoding configuration #230
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,8 +27,20 @@ def admin_theme_dir | |
# | ||
# @return [String] DSN (Data Source Name) is configuration for database. | ||
def dsn | ||
database_config['dsn'] | ||
end | ||
|
||
## | ||
# Data Source Hash | ||
# | ||
# @return [Hash] DSH (Data Source Hash) is configuration for database. | ||
def dsh | ||
database_config.dup.delete_if {|key, _| key == 'dsn' } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Space between { and | missing. |
||
end | ||
|
||
def database_config | ||
filename = File.exist?("#{Lokka.root}/database.yml") ? 'database.yml' : 'database.default.yml' | ||
YAML.load(ERB.new(File.read("#{Lokka.root}/#{filename}")).result(binding))[self.env]['dsn'] | ||
YAML.load(ERB.new(File.read("#{Lokka.root}/#{filename}")).result(binding))[self.env] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Prefer using YAML.safe_load over YAML.load. |
||
end | ||
|
||
## | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.