Move db_name default into config_spec.ini
authorElrond <elrond+mediagoblin.org@samba-tng.org>
Mon, 11 Jul 2011 21:25:15 +0000 (23:25 +0200)
committerElrond <elrond+mediagoblin.org@samba-tng.org>
Mon, 11 Jul 2011 21:25:15 +0000 (23:25 +0200)
The default name of the database ("mediagoblin") was coded
in db/open.py and init/celery/__init__.py.
Instead use the new config system to have this as the
default for the "db_name" config option.

mediagoblin/config_spec.ini
mediagoblin/db/open.py
mediagoblin/init/celery/__init__.py

index b6356b0ecb8bec311901e1eea6cf9e52d52eb2e2..28be5f343aad55195b945e1407e8cc1d3b1edd07 100644 (file)
@@ -1,7 +1,7 @@
 [mediagoblin]
 # database stuff
 db_host = string()
-db_name = string()
+db_name = string(default="mediagoblin")
 db_port = integer()
 
 # 
index cae3339404a17885ec6ecd48ecf745cd680bfc54..b69876773a2c56b89b856505cd9316e2473970f4 100644 (file)
@@ -30,7 +30,7 @@ def connect_database_from_config(app_config):
 
 def setup_connection_and_db_from_config(app_config):
     connection = connect_database_from_config(app_config)
-    database_path = app_config.get('db_name', 'mediagoblin')
+    database_path = app_config['db_name']
     db = connection[database_path]
     models.register_models(connection)
     # Could configure indexes here on db
index 67c3dfa059619825b112d5f88446e4389694322e..bfae954e9fe922b81a134ba493bc29abadfe0d3f 100644 (file)
@@ -62,7 +62,7 @@ def setup_celery_from_config(app_config, global_config,
         celery_mongo_settings['port'] = app_config['db_port']
         if celery_settings['BROKER_BACKEND'] == 'mongodb':
             celery_settings['BROKER_PORT'] = app_config['db_port']
-    celery_mongo_settings['database'] = app_config.get('db_name', 'mediagoblin')
+    celery_mongo_settings['database'] = app_config['db_name']
 
     celery_settings['CELERY_MONGODB_BACKEND_SETTINGS'] = celery_mongo_settings