Change config boolean examples
Closed this issue · 2 comments
Moved from Archivesspace repo (archivesspace/archivesspace#918):
From hietpasd (https://github.com/hietpasd):
Pretty minor but threw me for a loop. At least in version 2.1, I kept getting DB connection errors.
The config.rb example shows:
#AppConfig[:allow_unsupported_database] = false
#AppConfig[:allow_non_utf8_mysql_database] = false
The example output from the error log files suggest you change it to this:
AppConfig[:allow_unsupported_database] = "true"
AppConfig[:allow_non_utf8_mysql_database] = "true"
I thought it was odd that it switched from bool to string so I tried first the bool approach
AppConfig[:allow_unsupported_database] = true
AppConfig[:allow_non_utf8_mysql_database] = true
and the bool approach ended up not working. I did what the log suggested and switched it to a string and it worked.
I'd recommend making a change to the config.rb examples to use the correct syntax.
Is there are reason why this is handled in this way in backend/model/db.rb?
The check for allow_non_utf8_mysql_database on L53 looks like this:
if !@opts[:skip_utf8_check] && pool.database_type == :mysql && AppConfig[:allow_non_utf8_mysql_database] != "true"
While the check for allow_unsupported_database on L38 looks like this:
if !AppConfig[:allow_unsupported_database]
It looks like this functionality was introduced in a commit way back in 2013 that added a bool config default but checked for a string in backend/model/db.rb: archivesspace/archivesspace@ab474cf#diff-542cef02fd4b9728e596a5dd45c83069
Wouldn't it make more sense to change line 53 to this, so that the bool config example is correct?
if !@opts[:skip_utf8_check] && pool.database_type == :mysql && !AppConfig[:allow_non_utf8_mysql_database]
After discussion with the technical documentation team, we decided to move this issue back to the main repo.