Since the application does not use a database, it's confusing to have to set a bogus database URL environment variable. This change follows [the Lucky guide][1] suggestion for disabling the need for database configuration. That makes the setup a little easier. [1]: https://www.luckyframework.org/guides/database/intro-to-avram-and-ormsmain
parent
93f5cb2d9e
commit
098f7fe0f9
@ -1,24 +1,10 @@
|
||||
database_name = "scribe_#{LuckyEnv.environment}"
|
||||
class UnusedDB < Avram::Database
|
||||
end
|
||||
|
||||
AppDatabase.configure do |settings|
|
||||
if LuckyEnv.production?
|
||||
settings.credentials = Avram::Credentials.parse(ENV["DATABASE_URL"])
|
||||
else
|
||||
settings.credentials = Avram::Credentials.parse?(ENV["DATABASE_URL"]?) || Avram::Credentials.new(
|
||||
database: database_name,
|
||||
hostname: ENV["DB_HOST"]? || "localhost",
|
||||
port: ENV["DB_PORT"]?.try(&.to_i) || 5432,
|
||||
username: ENV["DB_USERNAME"]? || "postgres",
|
||||
password: ENV["DB_PASSWORD"]? || "postgres"
|
||||
)
|
||||
end
|
||||
UnusedDB.configure do |settings|
|
||||
settings.credentials = Avram::Credentials.void
|
||||
end
|
||||
|
||||
Avram.configure do |settings|
|
||||
settings.database_to_migrate = AppDatabase
|
||||
settings.lazy_load_enabled = LuckyEnv.production?
|
||||
|
||||
# Always parse `Time` values with these specific formats.
|
||||
# Used for both database values, and datetime input fields.
|
||||
# settings.time_formats << "%F"
|
||||
settings.database_to_migrate = UnusedDB
|
||||
end
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo -e "port: ${SCRIBE_PORT}\nhost: ${SCRIBE_HOST}\ndatabase: ${SCRIBE_DB}" > ./config/watch.yml
|
||||
echo -e "port: ${SCRIBE_PORT}\nhost: ${SCRIBE_HOST}" > ./config/watch.yml
|
||||
./start_server
|
||||
|
@ -1,2 +0,0 @@
|
||||
class AppDatabase < Avram::Database
|
||||
end
|
@ -1,3 +1,3 @@
|
||||
module Scribe
|
||||
VERSION = "2022-04-04"
|
||||
VERSION = "2022-05-21"
|
||||
end
|
||||
|
Loading…
Reference in new issue