mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-06-06 13:30:41 +02:00
docs: updating and adding links
This commit is contained in:
parent
6ba5193e9e
commit
b9cec19b02
@ -30,7 +30,7 @@ example of how to separate service code from configuration.
|
|||||||
|
|
||||||
- **`ENVIRONMENT`**:
|
- **`ENVIRONMENT`**:
|
||||||
Defines the operation mode (`"development"` or `"production"`), which influences
|
Defines the operation mode (`"development"` or `"production"`), which influences
|
||||||
behaviour such as logging (see [Logging in pydase](https://github.com/tiqi-group/pydase?tab=readme-ov-file#logging-in-pydase)).
|
behaviour such as logging (see [Logging in pydase](./Logging.md)).
|
||||||
|
|
||||||
- **`SERVICE_CONFIG_DIR`**:
|
- **`SERVICE_CONFIG_DIR`**:
|
||||||
Specifies the directory for configuration files (e.g., `web_settings.json`). Defaults
|
Specifies the directory for configuration files (e.g., `web_settings.json`). Defaults
|
||||||
@ -46,7 +46,7 @@ example of how to separate service code from configuration.
|
|||||||
port. Default: `8001`.
|
port. Default: `8001`.
|
||||||
|
|
||||||
- **`GENERATE_WEB_SETTINGS`**:
|
- **`GENERATE_WEB_SETTINGS`**:
|
||||||
When `true`, generates or updates the `web_settings.json` file. Existing entries are
|
When `true`, generates or updates the `web_settings.json` file (see [Tailoring Frontend Component Layout](../interaction/#tailoring-frontend-component-layout)). Existing entries are
|
||||||
preserved, and new entries are appended.
|
preserved, and new entries are appended.
|
||||||
|
|
||||||
### Configuring `pydase` via Keyword Arguments
|
### Configuring `pydase` via Keyword Arguments
|
||||||
@ -70,32 +70,32 @@ server = Server(
|
|||||||
|
|
||||||
## Separating Service Code from Configuration
|
## Separating Service Code from Configuration
|
||||||
|
|
||||||
To decouple configuration from code, `pydase` utilizes `confz` for configuration
|
To decouple configuration from code, `pydase` utilizes `confz` for configuration
|
||||||
management. Below is an example that demonstrates how to configure a `pydase` service
|
management. Below is an example that demonstrates how to configure a `pydase` service
|
||||||
for a sensor readout application.
|
for a sensor readout application.
|
||||||
|
|
||||||
### Scenario: Configuring a Sensor Service
|
### Scenario: Configuring a Sensor Service
|
||||||
|
|
||||||
Imagine you have multiple sensors distributed across your lab. You need to configure
|
Imagine you have multiple sensors distributed across your lab. You need to configure
|
||||||
each service instance with:
|
each service instance with:
|
||||||
|
|
||||||
1. **Hostname**: The hostname or IP address of the sensor.
|
1. **Hostname**: The hostname or IP address of the sensor.
|
||||||
2. **Authentication Token**: A token or credentials to authenticate with the sensor.
|
2. **Authentication Token**: A token or credentials to authenticate with the sensor.
|
||||||
3. **Readout Interval**: A periodic interval to read sensor data and log it to a
|
3. **Readout Interval**: A periodic interval to read sensor data and log it to a
|
||||||
database.
|
database.
|
||||||
|
|
||||||
Given the repository structure:
|
Given the repository structure:
|
||||||
|
|
||||||
```bash title="Service Repository Structure"
|
```bash title="Service Repository Structure"
|
||||||
my_sensor
|
my_sensor
|
||||||
├── pyproject.toml
|
├── pyproject.toml
|
||||||
├── README.md
|
├── README.md
|
||||||
└── src
|
└── src
|
||||||
└── my_sensor
|
└── my_sensor
|
||||||
├── my_sensor.py
|
├── my_sensor.py
|
||||||
├── config.py
|
├── config.py
|
||||||
├── __init__.py
|
├── __init__.py
|
||||||
└── __main__.py
|
└── __main__.py
|
||||||
```
|
```
|
||||||
|
|
||||||
Your service might look like this:
|
Your service might look like this:
|
||||||
@ -119,7 +119,7 @@ class MySensorConfig(confz.BaseConfig):
|
|||||||
|
|
||||||
This class defines configurable parameters and loads values from a `config.yaml` file
|
This class defines configurable parameters and loads values from a `config.yaml` file
|
||||||
located in the service’s configuration directory (which is configurable through an
|
located in the service’s configuration directory (which is configurable through an
|
||||||
environment variable, see [above](#configuring-pydase-using-environment-variables)).
|
environment variable, see [above](#configuring-pydase-using-environment-variables)).
|
||||||
A sample YAML file might look like this:
|
A sample YAML file might look like this:
|
||||||
|
|
||||||
```yaml title="config.yaml"
|
```yaml title="config.yaml"
|
||||||
|
@ -89,7 +89,7 @@ Each key in the file corresponds to the full access path of public attributes, p
|
|||||||
- **Control Component Visibility**: Utilize the `"display"` key-value pair to control whether a component is rendered in the frontend. Set the value to `true` to make the component visible or `false` to hide it.
|
- **Control Component Visibility**: Utilize the `"display"` key-value pair to control whether a component is rendered in the frontend. Set the value to `true` to make the component visible or `false` to hide it.
|
||||||
- **Adjustable Component Order**: The `"displayOrder"` values determine the order of components. Alter these values to rearrange the components as desired. The value defaults to [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER).
|
- **Adjustable Component Order**: The `"displayOrder"` values determine the order of components. Alter these values to rearrange the components as desired. The value defaults to [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER).
|
||||||
|
|
||||||
The `web_settings.json` file will be stored in the directory specified by the `SERVICE_CONFIG_DIR` environment variable. You can generate a `web_settings.json` file by setting the `GENERATE_WEB_SETTINGS` to `True`. For more information, see the [configuration section](../Configuration).
|
The `web_settings.json` file will be stored in the directory specified by the `SERVICE_CONFIG_DIR` environment variable. You can generate a `web_settings.json` file by setting the `GENERATE_WEB_SETTINGS` to `True`. For more information, see the [configuration section](../Configuration.md).
|
||||||
|
|
||||||
For example, styling the following service
|
For example, styling the following service
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user