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
> These template files were carefully crafted to work for you with minimal personal changes to bring, and some preconfigured services.
236
240
237
241
For later reference, these settings are documented in [app/core/config.py](./app/core/config.py).
238
242
Check this file to know what can and should be set using these two files.
239
243
240
-
### `.env`
244
+
### The `.env` file
241
245
242
246
The `.env` contains environment variables which need to be accessed by the OS or by other services, such as the database.
243
247
@@ -274,7 +278,7 @@ POSTGRES_DB="hyperion"
274
278
275
279
</details>
276
280
277
-
### `config.yaml`
281
+
### The `config.yaml` file
278
282
279
283
The `config.yaml` contains environment variables that are internal to the Python runtime _because_ they are only used in the Python code.
280
284
@@ -289,7 +293,10 @@ The `config.yaml` contains environment variables that are internal to the Python
289
293
- If you use **PostgreSQL**: empty this field.
290
294
Hyperion will fallback to PostgreSQL settings.
291
295
4.`USE_FACTORIES`: `True` by default, factories seed your database, if empty, with mocked data.
292
-
This is useful on SQLite to repopulate your new database after dropping the previous one.
296
+
This is useful on SQLite to repopulate your new database after dropping the previous one, of to create automatically your own user with admin privileges (see `FACTORIES_DEMO_USERS` below).
297
+
5.`FACTORIES_DEMO_USERS`: **Replace the first user's data with yours**.
298
+
These future users will be created automatically when launching Hyperion with an empty database.
299
+
Plus, your user will be there with your password and be admin out of the box.
293
300
294
301
## 5. Launch the API
295
302
@@ -311,15 +318,21 @@ fastapi dev
311
318
312
319
Check that your Hyperion instance is up and running by navigating to http://localhost:8000/information.
313
320
314
-
## 6. Create your own user
321
+
## 6. Create your own user (if not yet the case using factories)
315
322
316
-
There are many ways to do so, ranked here from easiest (GUI only) to hardest (CLI only).
317
-
Note that registration and activation are distinct steps, so for fun you may register one way and activate your account another way.
323
+
There are at least 5 distinct ways to do so outside the use of factories, ranked here from easiest (~GUI) to hardest (~CLI).
324
+
325
+
> [!IMPORTANT]
326
+
> Using factories is the recommended way.
327
+
> All others methods are legacy and kept here for historical reasons.
328
+
> Feel free to create other users other ways for learning purposes.
329
+
330
+
Note that registration and activation are distinct steps when calling calls to the API, so for fun you may register one way and activate your account another way (if you create your user directly in database, this distinction is not relevant).
318
331
319
332
<details>
320
333
<summary>
321
334
322
-
### With CalypSSO
335
+
### Using CalypSSO
323
336
324
337
</summary>
325
338
@@ -337,7 +350,7 @@ Open it and activate (end the creation of) your account.
337
350
<details>
338
351
<summary>
339
352
340
-
### With Titan
353
+
### Using Titan
341
354
342
355
</summary>
343
356
@@ -412,17 +425,54 @@ curl --json '{
412
425
413
426
</details>
414
427
415
-
## 7. Make the first user admin
428
+
<details>
429
+
<summary>
430
+
431
+
### Using a database client in command line
432
+
433
+
</summary>
416
434
417
435
> [!WARNING]
418
-
> This may not work if you ran the factories
436
+
> Work in progress
437
+
438
+
1. Open a shell connected to your database for Hyperion
439
+
- PostgreSQL: see above, generally `psql -U <username> -d hyperion`.
440
+
- SQLite: ...
441
+
2. Insert your own user into the users' table (for `centrale_lyon` school, generate your own user UUID and salted hash, feel free to add insert values into nullable columns) :
Copy file name to clipboardExpand all lines: config.template.yaml
+53-5Lines changed: 53 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -49,15 +49,21 @@ CLIENT_URL: http://127.0.0.1:8000/ # NOTE: A trailing / is required
49
49
# - but the docker container should call http://host.docker.internal:8000/auth/token and not your localhost address
50
50
#OVERRIDDEN_CLIENT_URL_FOR_OIDC: "http://host.docker.internal:8000/" # NOTE: A trailing / is required
51
51
52
-
# Configure AuthClients, to allow services to authenticate users using OAuth2 or Openid connect
53
-
# The following format should be used in yaml config files:
54
52
# Origins for the CORS middleware. `["http://localhost:3000"]` can be used for development.
55
53
# See https://fastapi.tiangolo.com/tutorial/cors/
56
54
# It should begin with 'http://' or 'https:// and should never end with a '/'
57
55
CORS_ORIGINS:
58
56
- "*"# For a local instance, using a wildcard "*" is convenient
59
57
# - http://localhost:3000
60
58
# - http://127.0.0.1:3000
59
+
60
+
################
61
+
# Auth Clients #
62
+
################
63
+
64
+
# Configure AuthClients, to allow services to authenticate users using OAuth2 or OpenID Connect
65
+
# The Python-expected type is `dict[str, AuthClientConfig]` where the class `AuthClientConfig` is from `app.core.utils.config`.
66
+
# Thus, the following format should be used in yaml config files:
61
67
# ```yml
62
68
# AUTH_CLIENTS:
63
69
# <ClientId>:
@@ -70,10 +76,12 @@ CORS_ORIGINS:
70
76
# `AuthClientClassName` should be a class from `app.utils.auth.providers`
71
77
AUTH_CLIENTS:
72
78
Titan:
73
-
secret:
79
+
secret:null # PKCE
74
80
redirect_uri:
75
81
- http://localhost:3000/static.html
76
82
- http://127.0.0.1:3000/static.html
83
+
- https://myecl.fr/static.html
84
+
- "fr.myecl.titan://authorized
77
85
auth_client: AppAuthClient
78
86
Postman:
79
87
secret: PostmanSecret
@@ -91,8 +99,48 @@ AUTH_CLIENTS:
91
99
SQLITE_DB: app.db # If set, the application use a SQLite database instead of PostgreSQL, for testing or development purposes (if possible PostgreSQL should be used instead)
92
100
DATABASE_DEBUG: False # If True, will print all SQL queries in the console
93
101
LOG_DEBUG_MESSAGES: False
94
-
# if True and the database is empty, it will be seeded with mocked data
95
-
USE_FACTORIES: True
102
+
NB_WORKERS: 6 # Not yet used...
103
+
104
+
#############
105
+
# Factories #
106
+
#############
107
+
108
+
USE_FACTORIES: True # if True and the database is empty, it will be seeded with mocked data
109
+
110
+
# Configure demo users, to populate the db with your users
111
+
# The Python-expected type is `list[UserDemoFactoryConfig]` where the class `UserDemoFactoryConfig` is from `app.core.utils.config`.
112
+
# Thus, the following format should be used in yaml config files:
0 commit comments