mirror of
https://github.com/nikdoof/smsbot.git
synced 2025-12-17 03:39:29 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
d00a4048cd
|
|||
|
bb5472f092
|
|||
|
6ce86042fb
|
|||
|
0a2970c38f
|
|||
|
126713c84a
|
|||
|
bace0200ab
|
20
.devcontainer/devcontainer.json
Normal file
20
.devcontainer/devcontainer.json
Normal 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1
.github/workflows/build-container.yaml
vendored
1
.github/workflows/build-container.yaml
vendored
@@ -31,6 +31,7 @@ jobs:
|
|||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
push: true
|
push: true
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
build-args: |
|
build-args: |
|
||||||
PYTHON_VERSION=${{ env.PYTHON_VERSION }}
|
PYTHON_VERSION=${{ env.PYTHON_VERSION }}
|
||||||
tags: |
|
tags: |
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ RUN --mount=type=cache,target=/root/.cache/uv \
|
|||||||
|
|
||||||
FROM python:${PYTHON_VERSION}-slim-bookworm
|
FROM python:${PYTHON_VERSION}-slim-bookworm
|
||||||
COPY --from=builder --chown=app:app /app /app
|
COPY --from=builder --chown=app:app /app /app
|
||||||
|
COPY ./docs/examples/config-basic.ini /app/config.ini
|
||||||
ENV PATH="/app/.venv/bin:$PATH"
|
ENV PATH="/app/.venv/bin:$PATH"
|
||||||
EXPOSE 5000/tcp
|
EXPOSE 5000/tcp
|
||||||
|
WORKDIR /app
|
||||||
CMD ["smsbot"]
|
CMD ["smsbot"]
|
||||||
|
|||||||
2
docs/examples/config-basic.ini
Normal file
2
docs/examples/config-basic.ini
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[logging]
|
||||||
|
level = INFO
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "smsbot"
|
name = "smsbot"
|
||||||
version = "0.2.1"
|
version = "0.2.2"
|
||||||
description = "A simple Telegram bot to receive SMS messages."
|
description = "A simple Telegram bot to receive SMS messages."
|
||||||
authors = [{ name = "Andrew Williams", email = "andy@tensixtyone.com" }]
|
authors = [{ name = "Andrew Williams", email = "andy@tensixtyone.com" }]
|
||||||
license = { text = "MIT" }
|
license = { text = "MIT" }
|
||||||
|
|||||||
@@ -15,6 +15,10 @@ from smsbot.utils import get_smsbot_version
|
|||||||
from smsbot.webhook import TwilioWebhookHandler
|
from smsbot.webhook import TwilioWebhookHandler
|
||||||
|
|
||||||
|
|
||||||
|
# Prefix of the environment variables to override config values
|
||||||
|
ENVIRONMENT_PREFIX = "SMSBOT_"
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser("smsbot")
|
parser = argparse.ArgumentParser("smsbot")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
@@ -44,9 +48,11 @@ def main():
|
|||||||
|
|
||||||
# Override with environment variables, named SMSBOT_<SECTION>_<VALUE>
|
# Override with environment variables, named SMSBOT_<SECTION>_<VALUE>
|
||||||
for key, value in os.environ.items():
|
for key, value in os.environ.items():
|
||||||
if key.startswith("SMSBOT_"):
|
if key.startswith(ENVIRONMENT_PREFIX):
|
||||||
logging.debug("Overriding config %s with value %s", key, value)
|
section, option = key[7:].lower().split("_", 1)
|
||||||
section, option = key[7:].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
|
config[section][option] = value
|
||||||
|
|
||||||
# Validate configuration
|
# Validate configuration
|
||||||
|
|||||||
2
uv.lock
generated
2
uv.lock
generated
@@ -592,7 +592,7 @@ wheels = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "smsbot"
|
name = "smsbot"
|
||||||
version = "0.2.1"
|
version = "0.2.2"
|
||||||
source = { editable = "." }
|
source = { editable = "." }
|
||||||
dependencies = [
|
dependencies = [
|
||||||
{ name = "flask", extra = ["async"] },
|
{ name = "flask", extra = ["async"] },
|
||||||
|
|||||||
Reference in New Issue
Block a user