You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The config file located at data/config.json is used to set default values for the following parameters.
3
+
The API can be configured to use different defaults for locations and hardware specs, as well as different levels of precision.
4
+
5
+
The full list of configuration parameters and their defaults can be found in [`boaviztapi/utils/config.py`](https://github.com/Boavizta/boaviztapi/blob/main/boaviztapi/utils/config.py).
6
+
7
+
## Overriding default values
8
+
9
+
Each variable can be overridden using an environment variable of the same name, prefixed with `BOAVIZTA_`.
10
+
11
+
For example, the `default_server` parameter can be overridden with the environment variable, `BOAVIZTA_DEFAULT_SERVER`.
12
+
13
+
## CORS
14
+
15
+
By default, all origins are allowed, but can be changed with the `BOAVIZTA_ALLOWED_ORIGINS` environment variable with the following format:
For example: `BOAVIZTA_ALLOWED_ORIGINS='["https://datavizta.boavizta.org","https://boavizta.org"]'`.
22
+
23
+
## Special message
24
+
25
+
You can customize the home page with a special message by setting the environment variable `BOAVIZTA_SPECIAL_MESSAGE` in HTML format.
26
+
27
+
For example: `BOAVIZTA_SPECIAL_MESSAGE="<p>my welcome message in HTML format</p>"`
4
28
5
29
## Default location
6
30
7
-
The default location will be used if the user does not specify a ```usage_location``` in the request.
8
-
The parameter is used to complete the impact of electricity.
31
+
The default location will be used if the user does not specify a `usage_location` in the request. The parameter is used to complete the impact of electricity.
9
32
10
33
```
11
34
default_location: "EEE"
12
35
```
13
36
37
+
This can be overridden with the `BOAVIZTA_DEFAULT_LOCATION` environment variable.
38
+
14
39
## Default archetype
15
40
16
-
The default archetype will be used if the user does not specify an ```archetype``` in the request.
17
-
Note that it must match an existing archetype ID in the archetype files.
41
+
The default archetype will be used if the user does not specify an `archetype` in the request. Note that it must match an existing archetype ID in the archetype files.
18
42
19
43
```
20
44
default_cpu: "DEFAULT"
21
45
default_server: "compute_medium"
22
46
```
23
47
24
-
## Default_criteria
48
+
These can be overridden with the `BOAVIZTA_DEFAULT_CPU` and `BOAVIZTA_DEFAULT_SERVER` environment variables.
25
49
26
-
The default criteria will be used if the user does not specify the ```criteria``` in the request.
50
+
## Default criteria
51
+
52
+
The default criteria will be used if the user does not specify the `criteria` in the request.
27
53
28
54
```
29
55
default_criteria: ["gwp", "adp", "pe"]
30
56
```
31
57
58
+
This can be overridden with the `BOAVIZTA_DEFAULT_CRITERIA` environment variable.
59
+
32
60
## Minimal significant figures
33
61
34
62
The minimal number of significant figures will be employed if classical rounding yields a result containing more significant figures than the minimal allowed.
@@ -39,16 +67,20 @@ min_sig_fig: 1
39
67
40
68
*If set to 1, the results will be rounded at least to 1 significant figures.*
41
69
70
+
This can be overridden with the `BOAVIZTA_MIN_SIG_FIG` environment variable.
42
71
43
72
## Maximal significant figures
44
73
45
74
The maximum number of significant figures will be employed if classical rounding yields a result containing more significant figures than the maximum allowed.
75
+
46
76
```
47
77
max_sig_fig: 5
48
78
```
49
79
50
80
*If set to 5, the results will be rounded to a maximum of 5 significant figures.*
51
81
82
+
This can be overridden with the `BOAVIZTA_MAX_SIG_FIG` environment variable.
83
+
52
84
## Uncertainty percentage
53
85
54
86
Uncertainty percentage is used to adapt the intensity of the rounding. The lower the uncertainty percentage, the lower aggressive the rounding.
@@ -59,10 +91,14 @@ uncertainty: 10
59
91
60
92
*If set to 10, the rounding aggressiveness will be set to 10%.*
61
93
94
+
This can be overridden with the `BOAVIZTA_UNCERTAINTY` environment variable.
95
+
62
96
## CPU name fuzzymatch threshold
63
97
64
98
The CPU name fuzzymatch threshold will determine the minimum similarity between the CPU name in the request and the CPU name in the database. If the similarity is lower than the threshold, the API will not use the match.
65
99
66
100
```
67
101
cpu_name_fuzzymatch_threshold: 62
68
-
```
102
+
```
103
+
104
+
This can be overridden with the `BOAVIZTA_CPU_NAME_FUZZYMATCH_THRESHOLD` environment variable.
When the deploy succeeds, it will show you the URLs for the deployed function, and you can call the API as normal. You can query these URLs at any time with `serverless info`.
Install dependencies and create a python virtual environment.
53
+
### Install
61
54
62
55
```bash
63
56
$ make install
64
-
$ poetry shell
65
57
```
66
58
67
-
#### Launch a development server
68
-
69
-
**Once in the poetry environment**
70
-
71
-
Development server uses [uvicorn](https://www.uvicorn.org/) and [fastapi](https://fastapi.tiangolo.com/), you can launch development server with the `uvicorn` CLI.
By default, all origin are allowed. If you need to limit them set env value ```ALLOWED_ORIGINS``` with the following format : ```ALLOWED_ORIGINS = '["url1", "url2", ...]'```
82
-
83
-
Example : ```ALLOWED_ORIGINS='["https://datavizta.boavizta.org","https://boavizta.org"]'```
84
-
85
-
### Special message
86
-
87
-
You can customize the home page with a special message by setting the env value ```SPECIAL_MESSAGE`` in HTML format.
88
-
89
-
Example : ```SPECIAL_MESSAGE="<p>my welcome message in HTML format</p>"```
0 commit comments