lib/thingfish/metastore/pggraph.rb
changeset 11 b1f97f6063a3
parent 8 1ad0d5bc5083
child 13 686fbfe638bd
--- a/lib/thingfish/metastore/pggraph.rb	Mon Nov 14 15:17:46 2016 -0800
+++ b/lib/thingfish/metastore/pggraph.rb	Mon Jan 16 12:47:50 2017 -0800
@@ -24,7 +24,7 @@
 
 
 	# Package version
-	VERSION = '0.1.3'
+	VERSION = '0.2.0'
 
 	# Version control revision
 	REVISION = %q$Revision$
@@ -40,31 +40,21 @@
 				'data' + 'thingfish-metastore-pggraph'
 		end
 
-	# The default config values
-	DEFAULT_CONFIG = {
-		uri: 'postgres:/thingfish',
-		slow_query_seconds: 0.01,
-	}
-
-
-	# Loggability API -- use a separate logger
 	log_as :thingfish_metastore_pggraph
 
 	# Configurability API -- load the `pg_metastore`
-	config_key :pggraph_metastore
+	configurability 'thingfish.pggraph_metastore' do
+
+		# The Sequel::Database that's used to access the metastore tables
+		setting :uri, default: 'postgres:/thingfish'
 
-	##
-	# The URI of the database to use for the metastore
-	singleton_attr_accessor :uri
+		# The number of seconds to consider a "slow" query
+		setting :slow_query_seconds, default: 0.01
+	end
 
-	##
 	# The Sequel::Database that's used to access the metastore tables
 	singleton_attr_accessor :db
 
-	##
-	# The number of seconds to consider a "slow" query
-	singleton_attr_accessor :slow_query_seconds
-
 
 	### Set up the metastore database and migrate to the latest version.
 	def self::setup_database
@@ -104,12 +94,8 @@
 	### Configurability API -- set up the metastore with the `pg_metastore` section of
 	### the config file.
 	def self::configure( config=nil )
-		config = self.defaults.merge( config || {} )
-
-		self.uri                = config[:uri]
-		self.slow_query_seconds = config[:slow_query_seconds]
-
-		self.setup_database
+		super
+		self.setup_database if self.uri
 	end