feat: Add API docs

Update the nginx configuration file to access API docs

Change-Id: I59dc9aee11f87f61d1ecb6095b16bed9658a58c0
This commit is contained in:
yangshaoxue 2022-11-02 14:31:12 +08:00
parent 1393aea120
commit ea69660e4d
6 changed files with 33 additions and 0 deletions

View File

@ -176,6 +176,11 @@ Skyline 像九色鹿一样,轻巧、优雅,而又能力强大,为 OpenStac
docker run -d --name skyline --restart=always -v /etc/skyline/skyline.yaml:/etc/skyline/skyline.yaml --net=host 99cloud/skyline:latest
API Doc
~~~~~~~~~
你可以使用 ``https://<ip_address>:9999/api/openstack/skyline/docs`` 来访问 API doc
访问测试
~~~~~~~~

View File

@ -112,6 +112,11 @@ Deployment with MariaDB
https://docs.openstack.org/skyline-apiserver/latest/install/docker-install-ubuntu.html
API Doc
~~~~~~~~~
You can visit the API doc ``https://<ip_address>:9999/api/openstack/skyline/docs``
Test Access
~~~~~~~~~~~

View File

@ -180,3 +180,8 @@ Finalize installation
If you need to modify skyline port, add ``-e LISTEN_ADDRESS=<ip:port>`` in run command.
Default port is 9999.
API Doc
---------
You can visit the API doc ``https://<ip_address>:9999/api/openstack/skyline/docs``

View File

@ -0,0 +1,6 @@
---
features:
- |
Added ``api_prefix`` forwarding to the nginx configuration file.
Now You can visit the API doc
``https://<ip_address>:9999/api/openstack/skyline/docs``.

View File

@ -31,6 +31,7 @@ from skyline_console import static_path
import skyline_apiserver
from skyline_apiserver.config import CONF, configure
from skyline_apiserver.log import LOG, setup
from skyline_apiserver.types import constants
class CommandException(Exception):
@ -166,6 +167,7 @@ def main(
context = {
"skyline_console_static_path": static_path,
"endpoints": [i.dict() for i in endpoints.values()],
"api_prefix": constants.API_PREFIX,
}
if ssl_certfile:
context.update(ssl_certfile=ssl_certfile)

View File

@ -98,6 +98,16 @@ http {
proxy_set_header Host $http_host;
}
location {{ api_prefix }}/ {
proxy_pass http://skyline{{ api_prefix }}/;
proxy_redirect off;
proxy_buffering off;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header Host $http_host;
}
{% for endpoint in endpoints %}
{{ endpoint["part"] }}
location {{ endpoint["location"] }} {