26 lines
668 B
Python
26 lines
668 B
Python
from flask import Flask, render_template, jsonify
|
|
from datetime import datetime, timezone
|
|
import os
|
|
|
|
app = Flask(__name__)
|
|
|
|
BUILD_VERSION = os.getenv('BUILD_VERSION', 'unknown')
|
|
GIT_COMMIT = os.getenv('GIT_COMMIT', 'unknown')
|
|
|
|
@app.route('/')
|
|
def index():
|
|
return render_template('index.html')
|
|
|
|
@app.route('/health')
|
|
def health():
|
|
return jsonify({
|
|
'status': 'healthy',
|
|
'timestamp': datetime.now(timezone.utc).isoformat(),
|
|
'version': BUILD_VERSION,
|
|
'commit': GIT_COMMIT[:7] if GIT_COMMIT != 'unknown' else 'unknown'
|
|
})
|
|
|
|
if __name__ == '__main__':
|
|
port = int(os.getenv('PORT', 5000))
|
|
app.run(host='0.0.0.0', port=port)
|