Skip to content

Commit

Permalink
Hub: Rename Config File to hub.toml
Browse files Browse the repository at this point in the history
Rename the file from `not-my-board-hub.toml` to `hub.toml`, because it's
easier to type. Move all the export descriptions into a subdirectory in
`/etc/not-my-board/`, so the names can't collide with config files like
`hub.toml`.
  • Loading branch information
holesch committed Aug 12, 2024
1 parent 70a2490 commit 3af8060
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 17 deletions.
4 changes: 2 additions & 2 deletions doc/how-to-guides/deploy-hub.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Add the OpenID configuration information to the *Hub* configuration. For example
when using Keycloak:

```{code-block} toml
:caption: /etc/not-my-board/not-my-board-hub.toml
:caption: /etc/not-my-board/hub.toml
[auth]
issuer = "http://keycloak.example.com/realms/master"
Expand All @@ -61,7 +61,7 @@ Then add permissions for users. You can get the claims from users after they log
in with `not-my-board login`, or from the OpenID provider.

```{code-block} toml
:caption: /etc/not-my-board/not-my-board-hub.toml
:caption: /etc/not-my-board/hub.toml
# [...]
Expand Down
2 changes: 1 addition & 1 deletion doc/how-to-guides/import-places-in-ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ system generate an ID token for your job.

For example with GitHub Actions, add permissions to the *Hub* config:
```{code-block} toml
:caption: /etc/not-my-board/not-my-board-hub.toml
:caption: /etc/not-my-board/hub.toml
[...]
Expand Down
10 changes: 5 additions & 5 deletions doc/how-to-guides/set-up-exporter.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ added (replace `<my-hub-address>` with the address or domain name of the *Hub*):
Description=Board Farm Exporter For Place %I
[Service]
ExecStart=/usr/local/bin/not-my-board export https://<my-hub-address> /etc/not-my-board/%i.toml
ExecStart=/usr/local/bin/not-my-board export https://<my-hub-address> /etc/not-my-board/export-descriptions/%i.toml
Restart=on-failure
RestartSec=10s
[Install]
WantedBy=multi-user.target
```

Create the export description in `/etc/not-my-board/`, for example:
Create the export description in `/etc/not-my-board/export-descriptions`, for example:
```{code-block} toml
:caption: /etc/not-my-board/example.toml
:caption: /etc/not-my-board/export-descriptions/example.toml
port = 29201
Expand Down Expand Up @@ -50,6 +50,6 @@ $ sudo systemctl enable --now not-my-board-exporter@example

:::{note}
The `example` instance name in the above command refers to the export
description in `/etc/not-my-board/`. By changing the instance name, you can
easily add new *Exporter* instances.
description in `/etc/not-my-board/export-descriptions`. By changing the instance
name, you can easily add new *Exporter* instances.
:::
4 changes: 2 additions & 2 deletions doc/how-to-guides/usb-export.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ $ sudo dmesg | grep usb
Now create the export description with the `usbid` of the USB device. If your
board has more than one USB interface, you can of course add them all:
```{code-block} toml
:caption: /etc/not-my-board/example.toml
:caption: /etc/not-my-board/export-descriptions/example.toml
port = 2192
Expand All @@ -101,5 +101,5 @@ usb.usb-serial = { usbid = "3-8" }

Finally, use the export description to register the place in the board farm:
```console
$ sudo not-my-board export http://<board-farm-address>:2092 /etc/not-my-board/example.toml
$ sudo not-my-board export http://<board-farm-address>:2092 /etc/not-my-board/export-descriptions/example.toml
```
11 changes: 5 additions & 6 deletions doc/reference/hub-configuration.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Hub Configuration

The *Hub* loads its configuration on startup from
`/etc/not-my-board/not-my-board-hub.toml`. You can override this location with
the environment variable `NOT_MY_BOARD_HUB_CONFIG`. The file format is
[TOML](https://toml.io/en/).
The *Hub* loads its configuration on startup from `/etc/not-my-board/hub.toml`.
You can override this location with the environment variable
`NOT_MY_BOARD_HUB_CONFIG`. The file format is [TOML](https://toml.io/en/).

## Settings

Expand Down Expand Up @@ -94,7 +93,7 @@ The following roles are defined:

Here's an example of a *Hub* configuration:
```{code-block} toml
:caption: /etc/not-my-board/not-my-board-hub.toml
:caption: /etc/not-my-board/hub.toml
log_level = "info"
Expand All @@ -114,7 +113,7 @@ roles = ["importer"]

And here's an example with Microsoft Entra ID as OpenID provider:
```{code-block} toml
:caption: /etc/not-my-board/not-my-board-hub.toml
:caption: /etc/not-my-board/hub.toml
log_level = "info"
[auth]
Expand Down
2 changes: 1 addition & 1 deletion not_my_board/_hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async def _handle_lifespan(scope, receive, send):
try:
config_file = os.environ.get("NOT_MY_BOARD_HUB_CONFIG")
if not config_file:
config_file = "/etc/not-my-board/not-my-board-hub.toml"
config_file = "/etc/not-my-board/hub.toml"
config_file = pathlib.Path(config_file)

if config_file.exists():
Expand Down

0 comments on commit 3af8060

Please sign in to comment.