Don't just use the first configuration with the database name, also check the environment.