6 Commits
0.2.1 ... 0.2.2

7 changed files with 36 additions and 5 deletions

View File

@@ -0,0 +1,20 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/python
{
"name": "Development",
"image": "mcr.microsoft.com/devcontainers/python:1-3.13-bookworm",
"features": {
"ghcr.io/eitsupi/devcontainer-features/go-task:1": {},
"ghcr.io/jsburckhardt/devcontainer-features/uv:1": {}
},
"forwardPorts": [
5000
],
"portsAttributes": {
"5000": {
"label": "Application",
"protocol": "http",
"public": true
}
}
}

View File

@@ -31,6 +31,7 @@ jobs:
uses: docker/build-push-action@v6
with:
push: true
platforms: linux/amd64,linux/arm64
build-args: |
PYTHON_VERSION=${{ env.PYTHON_VERSION }}
tags: |

View File

@@ -15,6 +15,8 @@ RUN --mount=type=cache,target=/root/.cache/uv \
FROM python:${PYTHON_VERSION}-slim-bookworm
COPY --from=builder --chown=app:app /app /app
COPY ./docs/examples/config-basic.ini /app/config.ini
ENV PATH="/app/.venv/bin:$PATH"
EXPOSE 5000/tcp
WORKDIR /app
CMD ["smsbot"]

View File

@@ -0,0 +1,2 @@
[logging]
level = INFO

View File

@@ -1,6 +1,6 @@
[project]
name = "smsbot"
version = "0.2.1"
version = "0.2.2"
description = "A simple Telegram bot to receive SMS messages."
authors = [{ name = "Andrew Williams", email = "andy@tensixtyone.com" }]
license = { text = "MIT" }

View File

@@ -15,6 +15,10 @@ from smsbot.utils import get_smsbot_version
from smsbot.webhook import TwilioWebhookHandler
# Prefix of the environment variables to override config values
ENVIRONMENT_PREFIX = "SMSBOT_"
def main():
parser = argparse.ArgumentParser("smsbot")
parser.add_argument(
@@ -44,9 +48,11 @@ def main():
# Override with environment variables, named SMSBOT_<SECTION>_<VALUE>
for key, value in os.environ.items():
if key.startswith("SMSBOT_"):
logging.debug("Overriding config %s with value %s", key, value)
section, option = key[7:].split("_", 1)
if key.startswith(ENVIRONMENT_PREFIX):
section, option = key[7:].lower().split("_", 1)
logging.debug("Overriding config %s/%s = %s", section, option, value)
if not config.has_section(section):
config.add_section(section)
config[section][option] = value
# Validate configuration

2
uv.lock generated
View File

@@ -592,7 +592,7 @@ wheels = [
[[package]]
name = "smsbot"
version = "0.2.1"
version = "0.2.2"
source = { editable = "." }
dependencies = [
{ name = "flask", extra = ["async"] },