feat: complete secure pricing delivery and rollback documentation
startup-product-gitea-ci/pipeline/pr-main There was a failure building this commit
startup-product-gitea-ci/pipeline/head There was a failure building this commit

This commit is contained in:
2026-11-13 21:07:53 -05:00
parent c6a53349ee
commit 36cec81744
52 changed files with 1716 additions and 5 deletions
+25
View File
@@ -0,0 +1,25 @@
from flask import Flask, jsonify
app = Flask(__name__)
@app.get("/health")
def health():
return jsonify({"status": "healthy"}), 200
@app.get("/pricing")
def pricing():
return jsonify({
"service": "Startup Pricing Service",
"version": "v1",
"plans": [
{"name": "Basic", "price": 10},
{"name": "Pro", "price": 25},
{"name": "Enterprise", "price": 50}
]
}), 200
if __name__ == "__main__":
app.run(host="0.0.0.0", port=5000)
@@ -0,0 +1,7 @@
.venv/
__pycache__/
*.pyc
.pytest_cache/
.git/
.env
.gitignore
+19
View File
@@ -0,0 +1,19 @@
FROM python:3.13-slim
WORKDIR /app
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY app.py .
RUN useradd --create-home appuser
USER appuser
EXPOSE 5000
CMD ["python", "app.py"]
@@ -0,0 +1,20 @@
FROM python:3.13-slim
WORKDIR /app
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
COPY requirements-production.txt .
RUN pip install --no-cache-dir -r requirements-production.txt
RUN useradd --create-home appuser
COPY --chown=appuser:appuser app.py .
USER appuser
EXPOSE 5000
CMD ["gunicorn", "--workers", "2", "--bind", "0.0.0.0:5000", "app:app"]
+26
View File
@@ -0,0 +1,26 @@
from flask import Flask, jsonify
app = Flask(__name__)
@app.get("/health")
def health():
return jsonify({"status": "healthy", "version": "v2"}), 200
@app.get("/pricing")
def pricing():
return jsonify({
"service": "Startup Pricing Service",
"version": "v2",
"plans": [
{"name": "Starter", "price": 5},
{"name": "Basic", "price": 12},
{"name": "Pro", "price": 30},
{"name": "Enterprise", "price": 60}
]
}), 200
if __name__ == "__main__":
app.run(host="0.0.0.0", port=5000)
@@ -0,0 +1,2 @@
Flask>=3.1,<4.0
gunicorn>=23,<24
@@ -0,0 +1 @@
Flask>=3.1,<4.0
+32
View File
@@ -0,0 +1,32 @@
import unittest
from app import app
class PricingServiceV2Tests(unittest.TestCase):
def setUp(self):
self.client = app.test_client()
def test_health_endpoint(self):
response = self.client.get("/health")
self.assertEqual(response.status_code, 200)
data = response.get_json()
self.assertEqual(data["status"], "healthy")
self.assertEqual(data["version"], "v2")
def test_pricing_endpoint(self):
response = self.client.get("/pricing")
self.assertEqual(response.status_code, 200)
data = response.get_json()
self.assertEqual(data["version"], "v2")
self.assertEqual(len(data["plans"]), 4)
self.assertEqual(data["plans"][0]["name"], "Starter")
self.assertEqual(data["plans"][0]["price"], 5)
if __name__ == "__main__":
unittest.main()