govariantsteam / govariants

A place to play Go variants
https://www.govariants.com
GNU Affero General Public License v3.0
5 stars 1 forks source link

Sanitize config as soon as it comes from db. #309

Closed benjaminpjones closed 1 month ago

benjaminpjones commented 1 month ago

Currently, we sanitize configs inside the Game objects, but there are other places that access configs. (e.g. GameView). Let's sanitize outwardFacingGame so that we can always assume we have a modern config.

benjaminpjones commented 1 month ago

Thanks for the thoughtful review and comments on types!

I'm still thinking of using some sort of data base migrations, or similar, to map old configs to the new structure.

Sounds good! I think this function could be useful for that as well - we could write a node script that pulls games from db and passes it through this sanitizeConfig function.