yearning-cli 0.1.9__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {yearning_cli-0.1.9 → yearning_cli-0.2.0}/.github/workflows/docker-image.yml +5 -5
- {yearning_cli-0.1.9 → yearning_cli-0.2.0}/Dockerfile +2 -1
- {yearning_cli-0.1.9 → yearning_cli-0.2.0}/PKG-INFO +1 -1
- {yearning_cli-0.1.9 → yearning_cli-0.2.0}/docker-compose.yml +1 -0
- {yearning_cli-0.1.9 → yearning_cli-0.2.0}/pyproject.toml +1 -1
- {yearning_cli-0.1.9 → yearning_cli-0.2.0}/uv.lock +1 -1
- {yearning_cli-0.1.9 → yearning_cli-0.2.0}/yearning_cli/cli.py +21 -2
- {yearning_cli-0.1.9 → yearning_cli-0.2.0}/.dockerignore +0 -0
- {yearning_cli-0.1.9 → yearning_cli-0.2.0}/.github/workflows/publish-pypi.yml +0 -0
- {yearning_cli-0.1.9 → yearning_cli-0.2.0}/.gitignore +0 -0
- {yearning_cli-0.1.9 → yearning_cli-0.2.0}/.python-version +0 -0
- {yearning_cli-0.1.9 → yearning_cli-0.2.0}/README.md +0 -0
- {yearning_cli-0.1.9 → yearning_cli-0.2.0}/mysql_proxy/README.md +0 -0
- {yearning_cli-0.1.9 → yearning_cli-0.2.0}/mysql_proxy/__init__.py +0 -0
- {yearning_cli-0.1.9 → yearning_cli-0.2.0}/mysql_proxy/protocol.py +0 -0
- {yearning_cli-0.1.9 → yearning_cli-0.2.0}/mysql_proxy/server.py +0 -0
- {yearning_cli-0.1.9 → yearning_cli-0.2.0}/renovate.json +0 -0
- {yearning_cli-0.1.9 → yearning_cli-0.2.0}/yearning_cli/__init__.py +0 -0
- {yearning_cli-0.1.9 → yearning_cli-0.2.0}/yearning_cli/__main__.py +0 -0
- {yearning_cli-0.1.9 → yearning_cli-0.2.0}/yearning_cli/client.py +0 -0
|
@@ -20,20 +20,20 @@ jobs:
|
|
|
20
20
|
uses: actions/checkout@v6
|
|
21
21
|
|
|
22
22
|
- name: Set up QEMU
|
|
23
|
-
uses: docker/setup-qemu-action@
|
|
23
|
+
uses: docker/setup-qemu-action@v4
|
|
24
24
|
|
|
25
25
|
- name: Set up Docker Buildx
|
|
26
|
-
uses: docker/setup-buildx-action@
|
|
26
|
+
uses: docker/setup-buildx-action@v4
|
|
27
27
|
|
|
28
28
|
- name: Login to Docker Hub
|
|
29
|
-
uses: docker/login-action@
|
|
29
|
+
uses: docker/login-action@v4
|
|
30
30
|
with:
|
|
31
31
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
32
32
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
33
33
|
|
|
34
34
|
- name: Docker metadata
|
|
35
35
|
id: meta
|
|
36
|
-
uses: docker/metadata-action@
|
|
36
|
+
uses: docker/metadata-action@v6
|
|
37
37
|
with:
|
|
38
38
|
images: ${{ env.IMAGE_NAME }}
|
|
39
39
|
tags: |
|
|
@@ -41,7 +41,7 @@ jobs:
|
|
|
41
41
|
type=raw,value=latest
|
|
42
42
|
|
|
43
43
|
- name: Build and push
|
|
44
|
-
uses: docker/build-push-action@
|
|
44
|
+
uses: docker/build-push-action@v7
|
|
45
45
|
with:
|
|
46
46
|
context: .
|
|
47
47
|
file: ./Dockerfile
|
|
@@ -2,6 +2,7 @@ FROM python:3.14-slim
|
|
|
2
2
|
|
|
3
3
|
ENV PYTHONUNBUFFERED=1 \
|
|
4
4
|
PIP_NO_CACHE_DIR=1 \
|
|
5
|
+
TZ=Asia/Shanghai \
|
|
5
6
|
SQL_PROXY_HOST=0.0.0.0 \
|
|
6
7
|
SQL_PROXY_PORT=3307
|
|
7
8
|
|
|
@@ -18,7 +19,7 @@ EXPOSE 3307
|
|
|
18
19
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
|
19
20
|
CMD python -c "import os, socket; s=socket.create_connection(('127.0.0.1', int(os.getenv('SQL_PROXY_PORT', '3307'))), 3); s.close()"
|
|
20
21
|
|
|
21
|
-
CMD sql proxy \
|
|
22
|
+
CMD sql proxy -v \
|
|
22
23
|
--host "${SQL_PROXY_HOST}" \
|
|
23
24
|
--port "${SQL_PROXY_PORT}" \
|
|
24
25
|
${SQL_PROXY_SOURCE:+--source "$SQL_PROXY_SOURCE"} \
|
|
@@ -12,6 +12,7 @@ services:
|
|
|
12
12
|
YEARNING_URL: "${YEARNING_URL:-http://192.168.1.135}"
|
|
13
13
|
YEARNING_USER: "${YEARNING_USER:-}"
|
|
14
14
|
YEARNING_PASS: "${YEARNING_PASS:-}"
|
|
15
|
+
TZ: "Asia/Shanghai"
|
|
15
16
|
SQL_PROXY_HOST: "0.0.0.0"
|
|
16
17
|
SQL_PROXY_PORT: "${SQL_PROXY_PORT:-3307}"
|
|
17
18
|
SQL_PROXY_SOURCE: "${SQL_PROXY_SOURCE:-}"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""CLI entry point for yearning-cli."""
|
|
2
2
|
|
|
3
3
|
import argparse
|
|
4
|
+
from datetime import datetime, timedelta, timezone
|
|
4
5
|
import logging
|
|
5
6
|
import os
|
|
6
7
|
import sys
|
|
@@ -12,6 +13,17 @@ from mysql_proxy.server import serve
|
|
|
12
13
|
|
|
13
14
|
BASE_URL = os.environ.get("YEARNING_URL", "http://192.168.1.135")
|
|
14
15
|
CONFIG_FILE = os.path.expanduser("~/.sqlrc")
|
|
16
|
+
EAST_8 = timezone(timedelta(hours=8))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class East8Formatter(logging.Formatter):
|
|
20
|
+
"""Format log timestamps with a fixed UTC+8 timezone."""
|
|
21
|
+
|
|
22
|
+
def formatTime(self, record: logging.LogRecord, datefmt: str | None = None) -> str:
|
|
23
|
+
dt = datetime.fromtimestamp(record.created, tz=EAST_8)
|
|
24
|
+
if datefmt:
|
|
25
|
+
return dt.strftime(datefmt)
|
|
26
|
+
return dt.strftime("%Y-%m-%d %H:%M:%S")
|
|
15
27
|
|
|
16
28
|
|
|
17
29
|
def load_config() -> dict:
|
|
@@ -359,10 +371,17 @@ def cmd_shell(args: argparse.Namespace) -> None:
|
|
|
359
371
|
def cmd_proxy(args: argparse.Namespace) -> None:
|
|
360
372
|
"""Start MySQL protocol proxy server."""
|
|
361
373
|
level = logging.DEBUG if VERBOSE else logging.INFO
|
|
374
|
+
handler = logging.StreamHandler()
|
|
375
|
+
handler.setFormatter(
|
|
376
|
+
East8Formatter(
|
|
377
|
+
fmt="%(asctime)s [%(levelname)s] %(message)s",
|
|
378
|
+
datefmt="%Y-%m-%d %H:%M:%S",
|
|
379
|
+
)
|
|
380
|
+
)
|
|
362
381
|
logging.basicConfig(
|
|
363
382
|
level=level,
|
|
364
|
-
|
|
365
|
-
|
|
383
|
+
handlers=[handler],
|
|
384
|
+
force=True,
|
|
366
385
|
)
|
|
367
386
|
if not VERBOSE:
|
|
368
387
|
logging.getLogger("websocket").setLevel(logging.WARNING)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|