Skip to content

Commit

Permalink
fix: Change templates.env.globals["url_for"] (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
allisson committed Dec 10, 2023
1 parent 53739b8 commit da8ac8a
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 16 deletions.
9 changes: 1 addition & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,6 @@ ENV PYTHONPATH /app
# Copy content from builder stage
COPY --from=builder /app /app

# Install packages
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install --no-install-recommends -y tini && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Add qrcode user and create directories
RUN useradd -m qrcode && mkdir -p /app

Expand All @@ -54,4 +47,4 @@ USER qrcode
EXPOSE 8000

# Set entrypoint and cmd
ENTRYPOINT ["/usr/bin/tini", "--", "uvicorn", "--host", "0.0.0.0", "--port", "8000", "secure_qrcode.api:app"]
ENTRYPOINT ["uvicorn", "--host", "0.0.0.0", "--port", "8000", "secure_qrcode.api:app"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Encrypt your data using the modern ChaCha20-Poly1305 cipher and export it into a

## access via browser

Open the url https://secure-qrcode.onrender.com on your browser.
Open the url https://secure-qrcode.fly.dev on your browser.

If you want to run this on your local machine, see the next section.

Expand Down
29 changes: 29 additions & 0 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# fly.toml app configuration file generated for secure-qrcode on 2023-12-10T16:41:32-03:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = "secure-qrcode"
primary_region = "dfw"

[build]

[http_service]
internal_port = 8000
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
processes = ["app"]

[[http_service.checks]]
grace_period = "10s"
interval = "60s"
method = "GET"
timeout = "5s"
path = "/healthz"

[[vm]]
cpu_kind = "shared"
cpus = 1
memory_mb = 256
14 changes: 7 additions & 7 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions secure_qrcode/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
)
app.mount("/static", StaticFiles(directory="static"), name="static")
templates = Jinja2Templates(directory="templates")
templates.env.globals["url_for"] = app.url_path_for


@app.exception_handler(DecryptError)
Expand Down

0 comments on commit da8ac8a

Please sign in to comment.