Add DatabasePathConfig struct and ResolveDatabasePath function that takes all dependencies as parameters, making it easier to test path resolution logic in isolation. Should also fix the reported cases. Resolves #2189