Browse Source

old_definitions in progress

main
pvincent 4 months ago
parent
commit
e0ae93658e
  1. 4
      .env.sample
  2. 28
      README.md
  3. 6
      lib/hot_constants/hot_constants.rb

4
.env.sample

@ -13,9 +13,9 @@ LOG_ACTIVE_RECORD=false
LOG_ACTION_VIEW=false
# with default value, type gets inferred from
INTEGER=1
INTEGER=a
STRING=456
BOOLEAN=true
BOOLEAN=false
# with no default value (evaluated to nil), type must be defined expressively otherwise it reverts to a string type
# INTEGER=:integer

28
README.md

@ -10,20 +10,17 @@ gem install bundler
bundle install
```
### database.yml
```yaml
[...]
development:
<<: *default
database: ruby-debug
user: ruby-debug
password: ruby-debug
host: ct1.lxd
[...]
```
rails generate scaffold score name:string grade:integer
rails db:migrate
## DATABASE
* # miaou, reuse dbs.lxd (or ct1.lxd)
* echo "DATABASE_HOST=ct1.lxd" >> .env
* # connect to miaou host
* db-psql create easy-going-rails
## RUN
* rails db:migrate
* ./bin/dev
## TODO
@ -69,9 +66,6 @@ rails db:migrate
* [ ] remove /bin/setup
* [ ] ask for main configuration (application_title, alpineJs)
* [ ] ViewComponent
* [ ] https://viewcomponent.org/
* [ ] Postgresql text search
* [ ] Fuzzy search with trigrams

6
lib/hot_constants/hot_constants.rb

@ -44,8 +44,10 @@ module HotConstants
new_env = Dotenv.parse
constants_to_delete = HOTENV.except(*new_env.keys)
constants_to_delete.each do |constant|
LOGGER.info("constant <#{constant}> reverts to default value <#{}>")
constants_to_delete.each do |name, _|
# FIXME: default should read default and type from @old_definitions
type, default = @old_definitions[name]
LOGGER.info("constant <#{name}> reverts to default value <#{default}> of type <#{type}>")
end
constants_to_add = new_env.except(*HOTENV.keys)

Loading…
Cancel
Save