28 lines
675 B
Ruby
28 lines
675 B
Ruby
require 'logger'
|
|
require 'sequel'
|
|
require 'sqlite3'
|
|
require 'sinatra'
|
|
|
|
require_relative 'lib/config.rb'
|
|
|
|
set :public_folder, __dir__ + '/public'
|
|
|
|
set :views, settings.root + '/views'
|
|
|
|
# Load configuration file
|
|
conf = Config.new(File.join(__dir__, 'data/defaults.yaml'))
|
|
|
|
# Initialize logging
|
|
logger = Logger.new(STDOUT)
|
|
logger.level = Logger::INFO
|
|
|
|
# Load the Sequel timestamps plugin
|
|
Sequel::Model.plugin :timestamps
|
|
# Initialize Sequel gem for database actions
|
|
DB = Sequel.connect(adapter: conf.get('database.adapter'), database: conf.get('database.database'))
|
|
# Load models
|
|
require_relative 'lib/models/item.rb'
|
|
|
|
# Register route handlers
|
|
require_relative 'lib/routes.rb'
|