require "kemal" require "json" require "jennifer" require "jennifer/adapter/postgres" require "./middleware/*" require "./controllers/*" require "./models/*" module ContainerMom::Web VERSION = "0.1.0" # Configure logging Log.setup_from_env # Configure database Jennifer::Config.configure do |conf| conf.from_uri(ENV["DATABASE_URL"]? || "postgres://postgres:postgres@localhost:5432/container_mom_development") conf.logger.level = :debug if ENV["DEBUG"]? end # Configure Kemal Kemal.config.port = ENV["PORT"]?.try(&.to_i) || 3000 Kemal.config.env = ENV["KEMAL_ENV"]? || "development" # Health check endpoint get "/health" do |env| env.response.content_type = "application/json" {status: "ok", version: VERSION}.to_json end # Main routes get "/" do |env| env.redirect "/deployments" end get "/deployments" do |env| render "src/web/views/deployments/index.ecr" end # Start the server def self.start Log.info { "Starting web portal v#{VERSION}" } Kemal.run end end # Start the application ContainerMom::Web.start