Skip to content
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

Implement a default database URL #10296

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions config/environment.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Load the rails application
require File.expand_path('application', __dir__)

# https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING
ENV['DATABASE_URL'] ||= case Rails.env
when 'production'
'postgresql://'
else
"postgresql:///foreman-#{Rails.env}"
end

# Initialize the rails application
Foreman::Application.initialize!
3 changes: 0 additions & 3 deletions developer_docs/foreman_dev_setup.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ sudo -u postgres createuser --createdb $USER
git clone https://github.com/{GITHUB_USER}/foreman.git -b develop
cd foreman
cp config/settings.yaml.example config/settings.yaml
cp config/database.yml.example config/database.yml
git remote add upstream [email protected]:theforeman/foreman.git
....

Expand Down Expand Up @@ -106,8 +105,6 @@ Foreman uses Bundler to install dependencies and get up and running. This is the

[[Database]]
== Setting the database
It is important that config/database.yml is set to use the correct database in the “development” block.
Rails (and subsequently Foreman) will use these connection settings under “development” to manage the database it uses and setup the necessary schema.

Set up database schema:
[source, ruby]
Expand Down
2 changes: 0 additions & 2 deletions lib/tasks/backup.rake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ namespace :db do
Make a dump of your database

Foreman will make a dump of your database at the provided location, or it will put it in #{File.expand_path('../../db', __dir__)} if no destination file is provided.
A valid config/database.yml file with the database details is needed to perform this operation.

Available conditions:
* destination => path to dump output file (defaults to #{File.expand_path('../../db', __dir__)}/foreman.EPOCH.sql)
Expand Down Expand Up @@ -73,7 +72,6 @@ namespace :db do
Import a database dump

Foreman will import a database from the provided location.
A valid config/database.yml file with the database details is needed to perform this operation.

Available conditions:
* file => database dump file path
Expand Down
Loading