| 1 | module config |
| 2 | |
| 3 | import os |
| 4 | |
| 5 | fn test_read_config_uses_database_defaults() { |
| 6 | path := os.join_path(os.temp_dir(), 'gitly_config_defaults_${os.getpid()}.json') |
| 7 | os.write_file(path, |
| 8 | '{"repo_storage_path":"./repos","archive_path":"./archives","avatars_path":"./avatars","hostname":"gitly.test","ci_service_url":"http://localhost:8081"}')! |
| 9 | defer { |
| 10 | os.rm(path) or {} |
| 11 | } |
| 12 | |
| 13 | conf := read_config(path)! |
| 14 | |
| 15 | assert conf.pg.host == 'localhost' |
| 16 | assert conf.pg.port == 5432 |
| 17 | assert conf.pg.dbname == 'gitly' |
| 18 | assert conf.pg.user == 'gitly' |
| 19 | assert conf.pg.password == 'gitly' |
| 20 | assert conf.sqlite.path == 'gitly.sqlite' |
| 21 | } |
| 22 | |