Open silva96 opened 8 months ago
I have experienced the same behavior. Litestack
should probably provide a runtime configuration code path; currently, the LITESTACK_DATA_PATH
and other configuration settings are loaded at boot time.
My workaround in Rails is to load dotenv
at the top of application.rb
, per the dotenv README.
That's a good one @rossta , with that comment in the readme at least, it would work for most users in the future.
@rossta's suggestion seems to work for some modules (database), but not all (queue, metrics). It seems that a more reliable solution is to provide hard-coded paths in the configs for these modules:
# config/litemetric.yml:
development:
path: ./storage/litestack/development/metrics.sqlite3
test:
path: ./storage/litestack/test/metrics.sqlite3
production:
path: ./storage/litestack/production/metrics.sqlite3
# config/litequeue.yml
development:
path: ./storage/litestack/development/queue.sqlite3
test:
path: ./storage/litestack/test/queue.sqlite3
production:
path: ./storage/litestack/production/queue.sqlite3
It also seems that these database files are being initialized even if the modules are not being used in the application. It would be nice to only have them initialized if they are needed.
If I add
LITESTACK_DATA_PATH="./storage"
to my.env
it is picked up after the litestack initializes some classes so it uses the default path to create the databases, but later on, it tries to find databases files in LITESTACK_DATA_PATH (i think)See this screenshot where I paused execution.
This leads to the app having sqlite3 files in 2 different parts: