From 35fa82002919003775919b5ca7e4ec1c69baa019 Mon Sep 17 00:00:00 2001 From: Roberto Alsina Date: Sun, 30 Jun 2024 11:55:46 -0300 Subject: [PATCH] Added basic auth for daemon --- .ameba.yml | 3 ++- shard.lock | 4 ++++ shard.yml | 9 +++++---- src/daemon.cr | 4 ++++ 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.ameba.yml b/.ameba.yml index 4440b96..09c71a0 100644 --- a/.ameba.yml +++ b/.ameba.yml @@ -1,5 +1,5 @@ # This configuration file was generated by `ameba --gen-config` -# on 2024-06-30 03:32:11 UTC using Ameba version 1.6.1. +# on 2024-06-30 14:55:35 UTC using Ameba version 1.6.1. # The point is for the user to remove these configuration records # one by one as the reported problems are removed from the code base. @@ -10,6 +10,7 @@ Documentation/DocumentationAdmonition: Timezone: UTC Excluded: - src/faaso.cr + - src/daemon.cr - src/funko.cr - spec/faaso_spec.cr Admonitions: diff --git a/shard.lock b/shard.lock index 450a741..61782b3 100644 --- a/shard.lock +++ b/shard.lock @@ -28,6 +28,10 @@ shards: git: https://github.com/kemalcr/kemal.git version: 1.5.0 + kemal-basic-auth: + git: https://github.com/kemalcr/kemal-basic-auth.git + version: 1.0.0 + radix: git: https://github.com/luislavena/radix.git version: 0.4.1 diff --git a/shard.yml b/shard.yml index 23204d2..13c2689 100644 --- a/shard.yml +++ b/shard.yml @@ -10,11 +10,10 @@ targets: faaso-daemon: main: src/daemon.cr -crystal: '>= 1.12.2' +crystal: ">= 1.12.2" license: MIT - dependencies: docr: github: ralsina/docr @@ -22,6 +21,8 @@ dependencies: commander: github: mrrooijen/commander kemal: - github: kemalcr/kemal + github: kemalcr/kemal + kemal-basic-auth: + github: kemalcr/kemal-basic-auth crinja: - github: straight-shoota/crinja \ No newline at end of file + github: straight-shoota/crinja diff --git a/src/daemon.cr b/src/daemon.cr index 1073197..5ea5a5b 100644 --- a/src/daemon.cr +++ b/src/daemon.cr @@ -1,5 +1,9 @@ require "docr" require "kemal" +require "kemal-basic-auth" + +# FIXME: make configurable +basic_auth "admin", "admin" current_config = ""