mirror of
https://framagit.org/framasoft/framaspace/argos.git
synced 2025-04-28 18:02:41 +02:00
🔀 Merge branch 'fix-59' into 'develop'
✨ — Allow to run Argos in a subfolder (i.e. not on /). Fix #59 See merge request framasoft/framaspace/argos!68
This commit is contained in:
commit
d2468eff6e
6 changed files with 29 additions and 2 deletions
|
@ -9,6 +9,7 @@
|
|||
- ✨ — Add new check types: headers-contain and headers-have
|
||||
- ✨ — Add command to test email configuration (!66)
|
||||
- 💄 — Enhance the mobile view (!67)
|
||||
- ✨ — Allow to run Argos in a subfolder (i.e. not on /) (#59)
|
||||
|
||||
## 0.2.2
|
||||
|
||||
|
|
|
@ -33,6 +33,11 @@ general:
|
|||
- local
|
||||
unknown:
|
||||
- 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:
|
||||
# mailfrom: no-reply@example.org
|
||||
|
|
|
@ -164,6 +164,7 @@ class General(BaseModel):
|
|||
frequency: int
|
||||
db: DbSettings
|
||||
env: Environment = "production"
|
||||
root_path: str = ""
|
||||
alerts: Alert
|
||||
mail: Optional[Mail] = None
|
||||
gotify: Optional[List[GotifyUrl]] = None
|
||||
|
|
|
@ -18,11 +18,19 @@ from argos.server.settings import read_yaml_config
|
|||
|
||||
def get_application() -> FastAPI:
|
||||
"""Spawn Argos FastAPI server"""
|
||||
appli = FastAPI(lifespan=lifespan)
|
||||
config_file = os.environ["ARGOS_YAML_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)
|
||||
appli.state.config = config
|
||||
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
|
||||
---
|
||||
```
|
||||
|
||||
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