From cd845d0c4ea75537d12261acb57fb328a056648d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Sodr=C3=A9?= Date: Fri, 1 May 2020 14:17:28 -0400 Subject: [PATCH 1/2] Add example app --- examples/chalice/.chalice/config.json | 9 +++++++++ examples/chalice/.gitignore | 2 ++ examples/chalice/app.py | 21 +++++++++++++++++++++ examples/chalice/requirements.txt | 1 + 4 files changed, 33 insertions(+) create mode 100644 examples/chalice/.chalice/config.json create mode 100644 examples/chalice/.gitignore create mode 100644 examples/chalice/app.py create mode 100644 examples/chalice/requirements.txt diff --git a/examples/chalice/.chalice/config.json b/examples/chalice/.chalice/config.json new file mode 100644 index 0000000..1fe7aa0 --- /dev/null +++ b/examples/chalice/.chalice/config.json @@ -0,0 +1,9 @@ +{ + "version": "2.0", + "app_name": "chalice", + "stages": { + "dev": { + "api_gateway_stage": "api" + } + } +} diff --git a/examples/chalice/.gitignore b/examples/chalice/.gitignore new file mode 100644 index 0000000..3dd60a9 --- /dev/null +++ b/examples/chalice/.gitignore @@ -0,0 +1,2 @@ +.chalice/deployments/ +.chalice/venv/ diff --git a/examples/chalice/app.py b/examples/chalice/app.py new file mode 100644 index 0000000..2234362 --- /dev/null +++ b/examples/chalice/app.py @@ -0,0 +1,21 @@ +import json + +from chalice import Chalice +from environs import Env + +from zeroae.goblet import chalice as goblet + +# Load Configuration Options +env: Env = Env() +env.read_env() +goblet.configure(env) + +# Register the Application +app = Chalice(app_name="chalice") +app.experimental_feature_flags.update(["BLUEPRINTS"]) +app.register_blueprint(goblet.bp, name_prefix="gh") + + +@goblet.bp.on_gh_event("ping") +def ping(payload): + app.log.info(json.dumps(payload)) diff --git a/examples/chalice/requirements.txt b/examples/chalice/requirements.txt new file mode 100644 index 0000000..3b77e74 --- /dev/null +++ b/examples/chalice/requirements.txt @@ -0,0 +1 @@ +zeroae-goblet From 6c0a1116d7e92dc0135286b702273470b4af2482 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Sodr=C3=A9?= Date: Fri, 1 May 2020 18:23:53 -0400 Subject: [PATCH 2/2] Change APP_DEFAULT_EVENTS to "public" Close #7 --- zeroae/goblet/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zeroae/goblet/config.py b/zeroae/goblet/config.py index 6944bb2..9eb509c 100644 --- a/zeroae/goblet/config.py +++ b/zeroae/goblet/config.py @@ -99,7 +99,7 @@ def _load_app_options(env: Env): APP_PUBLIC = env.bool("PUBLIC", True) with env.prefixed("DEFAULT_"): APP_DEFAULT_EVENTS = env.list( - "EVENTS", "push", validate=ContainsOnly(valid_events) + "EVENTS", "public", validate=ContainsOnly(valid_events) ) APP_DEFAULT_PERMISSIONS = env.dict("PERMISSIONS", "metadata=read")