From e8a3a3b1489990cecd02b3780f0f0faff722f107 Mon Sep 17 00:00:00 2001 From: otegami Date: Tue, 10 Dec 2024 11:45:12 +0900 Subject: [PATCH] release: add Rack application skeleton of webhook auto signer GitHub: GH-43 In this PR, we set up a rack application skeleton of webhook auto signer. At the following PRs, we will implement the logic. --- ansible/files/home/signer/webhook/.gitignore | 1 + ansible/files/home/signer/webhook/Gemfile | 3 +++ ansible/files/home/signer/webhook/config.ru | 10 ++++++++++ .../files/home/signer/webhook/lib/webhook-signer.rb | 1 + .../home/signer/webhook/lib/webhook-signer/app.rb | 7 +++++++ 5 files changed, 22 insertions(+) create mode 100644 ansible/files/home/signer/webhook/.gitignore create mode 100644 ansible/files/home/signer/webhook/Gemfile create mode 100644 ansible/files/home/signer/webhook/config.ru create mode 100644 ansible/files/home/signer/webhook/lib/webhook-signer.rb create mode 100644 ansible/files/home/signer/webhook/lib/webhook-signer/app.rb diff --git a/ansible/files/home/signer/webhook/.gitignore b/ansible/files/home/signer/webhook/.gitignore new file mode 100644 index 0000000..66f8ed3 --- /dev/null +++ b/ansible/files/home/signer/webhook/.gitignore @@ -0,0 +1 @@ +/Gemfile.lock diff --git a/ansible/files/home/signer/webhook/Gemfile b/ansible/files/home/signer/webhook/Gemfile new file mode 100644 index 0000000..e965cf0 --- /dev/null +++ b/ansible/files/home/signer/webhook/Gemfile @@ -0,0 +1,3 @@ +source "https://rubygems.org" + +gem "rack" diff --git a/ansible/files/home/signer/webhook/config.ru b/ansible/files/home/signer/webhook/config.ru new file mode 100644 index 0000000..7894edf --- /dev/null +++ b/ansible/files/home/signer/webhook/config.ru @@ -0,0 +1,10 @@ +require "pathname" + +base_dir = Pathname(__FILE__).dirname +lib_dir = base_dir + "lib" + +$LOAD_PATH.unshift(lib_dir.to_s) + +require "webhook-signer" + +run WebhookSigner::App.new diff --git a/ansible/files/home/signer/webhook/lib/webhook-signer.rb b/ansible/files/home/signer/webhook/lib/webhook-signer.rb new file mode 100644 index 0000000..0207fbb --- /dev/null +++ b/ansible/files/home/signer/webhook/lib/webhook-signer.rb @@ -0,0 +1 @@ +require "webhook-signer/app" diff --git a/ansible/files/home/signer/webhook/lib/webhook-signer/app.rb b/ansible/files/home/signer/webhook/lib/webhook-signer/app.rb new file mode 100644 index 0000000..9c91cd7 --- /dev/null +++ b/ansible/files/home/signer/webhook/lib/webhook-signer/app.rb @@ -0,0 +1,7 @@ +module WebhookSigner + class App + def call(env) + [200, {}, ["Hello Webhook Signer"]] + end + end +end