Skip to content

Commit 5032835

Browse files
committed
add description to /
1 parent 0cd37d9 commit 5032835

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

app.py

+28-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,22 @@ def create_app():
1313

1414
@app.route("/")
1515
def index():
16-
return f"""Usage: curl {request.host_url}container -d '{{"id":"123", "hostname":123, "memory": 1024, "ssh_public_keys": "<string-of-your-public-key>", "network": {{}}}}'"""
16+
return f"""<h1>Create lxc container on proxmox via http api</h1>
17+
<p>Specify</p>
18+
<ul>
19+
<li>Ram</li>
20+
<li>Hostname</li>
21+
<li>Public ssh key (so you can login)</li>
22+
</ul>
23+
<p>You get:</p>
24+
<ul>
25+
<li>ipv6 public address for each container</li>
26+
<li>You can ssh into the container</li>
27+
</ul>
28+
<h2>Usage:</h2>
29+
<pre>curl {request.host_url}container -d '{{"id":"123", "hostname":123, "memory": 1024, "ssh_public_keys": "<string-of-your-public-key>", "network": {{}}}}'</pre>\n
30+
<p>Then ssh into your container: ssh root@&lt;public_ip&gt; using the public key you provided.</p>
31+
<br /><a href="/openapi">View Openapi</a>"""
1732

1833
@app.route("/container", methods=["POST"])
1934
def create_container():
@@ -72,6 +87,18 @@ def get_ip():
7287
def health():
7388
return "OK"
7489

90+
@app.route("/redoc")
91+
@app.route("/openapi")
92+
def redoc():
93+
return """<body>
94+
<div id="redoc-container"></div>
95+
<script src="//cdn.jsdelivr.net/npm/[email protected]/bundles/redoc.standalone.min.js"> </script>
96+
<script src="//cdn.jsdelivr.net/gh/wll8/[email protected]/dist/try.js"></script>
97+
<script>
98+
initTry(`https://raw.githubusercontent.com/chrisjsimpson/lxc-proxmox-http-api-create-containers/main/openapi.yaml`)
99+
</script>
100+
</body>"""
101+
75102
# Return fask wsgi app
76103
return app
77104

0 commit comments

Comments
 (0)