-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We needed more flexibility to handle development vs production run.
- Loading branch information
Showing
4 changed files
with
112 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
web: uvicorn qualicharge.api:app --proxy-headers --host 0.0.0.0 --port $PORT | ||
web: bash ./start.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
version: 1 | ||
disable_existing_loggers: false | ||
formatters: | ||
default: | ||
"()": uvicorn.logging.DefaultFormatter | ||
fmt: "%(levelprefix)s %(message)s" | ||
use_colors: true | ||
access: | ||
"()": uvicorn.logging.AccessFormatter | ||
fmt: '%(levelprefix)s %(client_addr)s - "%(request_line)s" %(status_code)s' | ||
use_colors: true | ||
handlers: | ||
default: | ||
formatter: default | ||
class: logging.StreamHandler | ||
stream: ext://sys.stderr | ||
access: | ||
formatter: access | ||
class: logging.StreamHandler | ||
stream: ext://sys.stdout | ||
loggers: | ||
uvicorn: | ||
handlers: | ||
- default | ||
level: INFO | ||
propagate: false | ||
uvicorn.error: | ||
level: INFO | ||
uvicorn.access: | ||
handlers: | ||
- access | ||
level: INFO | ||
propagate: false | ||
qualicharge: | ||
handlers: | ||
- default | ||
level: DEBUG | ||
propagate: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
version: 1 | ||
disable_existing_loggers: false | ||
formatters: | ||
default: | ||
"()": uvicorn.logging.DefaultFormatter | ||
fmt: "%(levelprefix)s %(message)s" | ||
use_colors: true | ||
access: | ||
"()": uvicorn.logging.AccessFormatter | ||
fmt: '%(levelprefix)s %(client_addr)s - "%(request_line)s" %(status_code)s' | ||
use_colors: true | ||
handlers: | ||
default: | ||
formatter: default | ||
class: logging.StreamHandler | ||
stream: ext://sys.stdout | ||
access: | ||
formatter: access | ||
class: logging.StreamHandler | ||
stream: ext://sys.stdout | ||
loggers: | ||
uvicorn: | ||
handlers: | ||
- default | ||
level: INFO | ||
propagate: false | ||
uvicorn.error: | ||
level: INFO | ||
uvicorn.access: | ||
handlers: | ||
- access | ||
level: INFO | ||
propagate: false | ||
qualicharge: | ||
handlers: | ||
- default | ||
level: WARNING | ||
propagate: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env bash | ||
|
||
# We may expect that the following environment variables are set: | ||
# | ||
# - PORT: the server port | ||
# - QUALICHARGE_DEBUG: activate the debug mode (for development) [*] | ||
# | ||
# [*] optional | ||
|
||
set -eo pipefail | ||
|
||
declare -i debug=${QUALICHARGE_DEBUG:-0} | ||
declare -a extra_opts | ||
|
||
if [ ${debug} == 1 ]; then | ||
extra_opts=( | ||
"--reload" \ | ||
"--log-config logging-config.dev.yaml" | ||
) | ||
echo "⚗️ DEBUG mode activated. We hope your are not running in production. 🤞" | ||
else | ||
extra_opts=( | ||
"--log-config logging-config.prod.yaml" | ||
) | ||
fi | ||
|
||
# shellcheck disable=SC2068 | ||
uvicorn \ | ||
qualicharge.api:app \ | ||
--proxy-headers \ | ||
--host 0.0.0.0 \ | ||
--port "${PORT}" \ | ||
${extra_opts[@]} |