added a mechanism for setting the database directory by the environment variable.