mirror of
https://framagit.org/framasoft/framaspace/argos.git
synced 2025-04-28 09:52:38 +02:00
✨ — Allow to run Argos in a subfolder (i.e. not on /). Fix #59
This commit is contained in:
parent
bc3bc52ed0
commit
95c49c5924
6 changed files with 29 additions and 2 deletions
|
@ -9,6 +9,7 @@
|
||||||
- ✨ — Add new check types: headers-contain and headers-have
|
- ✨ — Add new check types: headers-contain and headers-have
|
||||||
- ✨ — Add command to test email configuration (!66)
|
- ✨ — Add command to test email configuration (!66)
|
||||||
- 💄 — Enhance the mobile view (!67)
|
- 💄 — Enhance the mobile view (!67)
|
||||||
|
- ✨ — Allow to run Argos in a subfolder (i.e. not on /) (#59)
|
||||||
|
|
||||||
## 0.2.2
|
## 0.2.2
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,11 @@ general:
|
||||||
- local
|
- local
|
||||||
unknown:
|
unknown:
|
||||||
- local
|
- local
|
||||||
|
# Argos root path
|
||||||
|
# If not present, default value is ""
|
||||||
|
# Set it to /foo if you want to use argos at /foo/ instead of /
|
||||||
|
# on your web server
|
||||||
|
# root_path: "/foo"
|
||||||
# Mail configuration is quite straight-forward
|
# Mail configuration is quite straight-forward
|
||||||
# mail:
|
# mail:
|
||||||
# mailfrom: no-reply@example.org
|
# mailfrom: no-reply@example.org
|
||||||
|
|
|
@ -164,6 +164,7 @@ class General(BaseModel):
|
||||||
frequency: int
|
frequency: int
|
||||||
db: DbSettings
|
db: DbSettings
|
||||||
env: Environment = "production"
|
env: Environment = "production"
|
||||||
|
root_path: str = ""
|
||||||
alerts: Alert
|
alerts: Alert
|
||||||
mail: Optional[Mail] = None
|
mail: Optional[Mail] = None
|
||||||
gotify: Optional[List[GotifyUrl]] = None
|
gotify: Optional[List[GotifyUrl]] = None
|
||||||
|
|
|
@ -18,11 +18,19 @@ from argos.server.settings import read_yaml_config
|
||||||
|
|
||||||
def get_application() -> FastAPI:
|
def get_application() -> FastAPI:
|
||||||
"""Spawn Argos FastAPI server"""
|
"""Spawn Argos FastAPI server"""
|
||||||
appli = FastAPI(lifespan=lifespan)
|
|
||||||
config_file = os.environ["ARGOS_YAML_FILE"]
|
config_file = os.environ["ARGOS_YAML_FILE"]
|
||||||
|
|
||||||
config = read_config(config_file)
|
config = read_config(config_file)
|
||||||
|
|
||||||
|
root_path = config.general.root_path
|
||||||
|
|
||||||
|
if root_path != "":
|
||||||
|
logger.info("Root path for Argos: %s", root_path)
|
||||||
|
if root_path.endswith("/"):
|
||||||
|
root_path = root_path[:-1]
|
||||||
|
logger.info("Fixed root path for Argos: %s", root_path)
|
||||||
|
|
||||||
|
appli = FastAPI(lifespan=lifespan, root_path=root_path)
|
||||||
|
|
||||||
# Config is the argos config object (built from yaml)
|
# Config is the argos config object (built from yaml)
|
||||||
appli.state.config = config
|
appli.state.config = config
|
||||||
appli.add_exception_handler(NotAuthenticatedException, auth_exception_handler)
|
appli.add_exception_handler(NotAuthenticatedException, auth_exception_handler)
|
||||||
|
|
4
conf/nginx-subdirectory.conf
Normal file
4
conf/nginx-subdirectory.conf
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
location /foo/ {
|
||||||
|
include proxy_params;
|
||||||
|
proxy_pass http://127.0.0.1:8000/;
|
||||||
|
}
|
|
@ -6,3 +6,11 @@ Here is a example for Nginx configuration:
|
||||||
caption: /etc/nginx/sites-available/argos.example.org
|
caption: /etc/nginx/sites-available/argos.example.org
|
||||||
---
|
---
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you want to use Argos under a subdirectory of your web server, you’ll need to set the `root_path` setting in Argos’s [configuration](../configuration.md) and set Nginx like this:
|
||||||
|
|
||||||
|
```{literalinclude} ../../conf/nginx-subdirectory.conf
|
||||||
|
---
|
||||||
|
caption: Nginx’s location for Argos in a subdirectory
|
||||||
|
---
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in a new issue