lib/bridgetown_notion.rb in bridgetown_notion-0.1.0 vs lib/bridgetown_notion.rb in bridgetown_notion-0.2.0
- old
+ new
@@ -1,5 +1,17 @@
# frozen_string_literal: true
require "bridgetown"
require "bridgetown_notion/builder"
require "notion-ruby-client"
+require "zeitwerk"
+
+loader = Zeitwerk::Loader.for_gem
+loader.setup
+
+Bridgetown.initializer :bridgetown_notion do |config, notion_key:, notion_db_id:|
+ config.bridgetown_notion ||= {}
+ config.bridgetown_notion.notion_key ||= notion_key || ENV.fetch("NOTION_KEY")
+ config.bridgetown_notion.notion_db_id ||= notion_db_id || ENV.fetch("NOTION_DB_ID")
+
+ config.builder BridgetownNotion::Builder
+end