Skip to content

Commit 44bba8b

Browse files
committed
Fix: test config
1 parent 6efee5e commit 44bba8b

File tree

2 files changed

+238
-40
lines changed

2 files changed

+238
-40
lines changed

tests/.env.test

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,32 @@
22
# This dotenv file and its values should NEVER be used in PRODUCTION! #
33
###########################################################################
44

5+
############################
6+
# PostgreSQL configuration #
7+
############################
8+
59
# Will be used if tests are run with postgresql (should be the case because postgres is used in production)
10+
# Should be set to the name of the postgres container
611
POSTGRES_HOST="localhost"
712
POSTGRES_USER="hyperion"
813
POSTGRES_PASSWORD="somerealpassword"
914
POSTGRES_DB="hyperion"
1015
POSTGRES_TZ="Etc/UTC"
1116

17+
########################
1218
# Redis configuration #
19+
########################
20+
# Redis configuration is needed to use the rate limiter, or multiple uvicorn workers
21+
# We use the default redis configuration, so the protected mode is enabled by default (see https://redis.io/docs/manual/security/#protected-mode)
22+
# If you want to use a custom configuration, a password and a specific binds should be used to avoid security issues
23+
24+
# REDIS_HOST may be commented to disable Redis during development if you don't have a redis server running, in production it should be set to the name of the redis container
1325
REDIS_HOST="localhost"
1426
REDIS_PORT=6379
27+
# Should be commented during development to work with docker-compose-dev, and set in production
1528
#REDIS_PASSWORD=""
1629
REDIS_LIMIT=5
1730
REDIS_WINDOW=60
31+
32+
33+

tests/config.test.yaml

Lines changed: 222 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,80 +2,262 @@
22
# This dotenv file and its values should NEVER be used in PRODUCTION! #
33
###########################################################################
44

5-
# SQLITE_DB: "test.db" # If set, the application use a SQLite database instead of PostgreSQL, for testing or development purposes (should not be used if possible)
5+
###############################################
6+
# Authorization using OAuth or Openid connect #
7+
###############################################
68

7-
# Authorization using JWT #
9+
# ACCESS_TOKEN_SECRET_KEY should contain a random string with enough entropy (at least 32 bytes long) to securely sign all access_tokens for OAuth and Openid connect
10+
# If you want to generate a 2048-bit long PEM certificate and save it in a file, the following command may be used:
11+
# openssl req -newkey rsa:2048 -nodes -keyout key.pem -x509 -days 365 -out certificate.pem
812
ACCESS_TOKEN_SECRET_KEY: "YWZOHliiI53lJMJc5BI_WbGbA4GF2T7Wbt1airIhOXEa3c021c4-1c55-4182-b141-7778bcc8fac4" # Note: modifing this token requires to update the common `test_check_settings_mocking` test
9-
RSA_PRIVATE_PEM_STRING: "-----BEGIN RSA PRIVATE KEY-----\nMIIEpQIBAAKCAQEA1tpj3TZDkJakp2RygsM392pQbcmNBOGFT8FlETcRG/JVFT7k\niClJu+CVOJSVD0epfpYp93cYepfw74SezYnBCyuoLJ2yg5Qh4KlCrWmvwM7vhFIN\nx0xddIQi+Gm0T3dxGtv4Ga50TYX4SV4FE3ctJG9m3pyNF6POODp5tMJvShQWYTto\nW9qNhltZ8Z+14bq2INV/efpT47WuMT+VD/fa9/WwopAtgBcQOvq57fv5+DaPOIVR\n9BiP7F+pv+v6wQ373hI22QzCMsA4Whl+BmWFKcFoBDOBRjlW5VqhJWJkWZIRP0q+\nVAZHk2xJK+0YFc9jmaC+ExMtuyHYK0RnQK/8LQIDAQABAoIBABxJ8v4sZ+cAvrs/\nkYhAFf1gpShfck7jNr9SknEa1Aje9m7usf5vmULAhkVF4v55DAsb0HjB2JpDqTiQ\nOKyNZ7qFzAXb2aZTecZv4tScZsS3OngsqZ3FI0T1JPmaSWBxNJY5wkf3XV7btd5L\nH9X5ShtTA7Np33XuXneu01mGhEq3boLro+vfXMHV5QHyle1F4LUFWEqtP0UmZ5wA\nrro0Y7pA8R88tu5X4iWEjQPnAsbRixwFQ9LNMD8+40e1UIguobRySnP5umErHaIh\nKui7ZijLjbZh/dPS0IfpgahL1K6s9XhT3mD9WMvAvMkNtLewHIZZukG45mOQBrjF\nvvyYxoECgYEA+EY6YimGw0IKnUuf+5uZRXST7kDMENz1Flkcj8oZvo47hdX8/lDN\ni0y7gm3VNfHAK2R2KZPmSbtXA0DvS7kmx1/CFcmwkaakhuU5dyCHldWwSaTME3IE\nxjSZfTvlAiq9i6nUflgfkKo3Bdsiq8TYOUAv25S2SwYDH9Tx0fQwwGECgYEA3Ynt\nCHc8e4YRlGT65UQmEZ8cptmqVRyY4ClMU1xht7Pn0G1JwKRraiEL5/LndwscWf3h\nDygQuArJ28pp4d22FEW1LeXozXYUjJoz3anIA45IZ1OihS7Cx7tJB51/QNJeFdF4\nEX/XHaVukHyYSsAxkwCUYOw3cSgZOSEddL5Wf00CgYEA7JlIlDmMwtFR+jqSmJ3c\n//Kr8zZvAnb/Xa/IZ0MrK4yyLsYR1m48o06Ztx9iO4lKIFAZx1+563QL5P7hzOEC\nkqev90GA8hzD2AXksKEgdOrymAvjq3hSEm0YBN+qS1ldzxYmec0TL7L2wq7lqJnr\nkQuZUAG1g2OUYKZ3WSUDvKECgYEAv24NSkFuG/avfiD7w9xtYNCye2KekskROLG2\n6FltfsWQTEQDdNkekChaF2WHqRAKwaBlNymRuNZpsuhnMerZCQ9rDWwbDF86RnyA\n0MuCr7/kxJQ6XQcY/GnTIydu7F5bOlM0gzqKcW2f6m4fUohczf+0N0QmbDsQAJOi\n1lwadgkCgYEA3tkCBJIPTQecfjWiLqSocS6SrwXU+r3Jw6kI3/IB6ban/nsFdHSb\nnADST7f2zZatN6XALwsLU7f2R09R39ub0AJPyfToxo7MngR1rvaUYooF3rLlaU32\n8DqGvGpLkZkwbtcDmcX1zQoHjUo7RvoShZoapr59ihfrkiiEsXOkuGw=\n-----END RSA PRIVATE KEY-----\n"
1013

11-
# Host or url of the API, used for Openid connect discovery endpoint
12-
# NOTE: A trailing / is required
13-
CLIENT_URL: "http://127.0.0.1:8000/"
14+
# RSA_PRIVATE_PEM_STRING should be a string containing the PEM certificate of a private RSA key. It will be used to sign id_tokens for Openid connect authentication
15+
# The example below was generated using a 2048-bit RSA key generator
16+
RSA_PRIVATE_PEM_STRING: |
17+
-----BEGIN RSA PRIVATE KEY-----
18+
MIIEpQIBAAKCAQEA1tpj3TZDkJakp2RygsM392pQbcmNBOGFT8FlETcRG/JVFT7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jqSmJ3c
35+
//Kr8zZvAnb/Xa/IZ0MrK4yyLsYR1m48o06Ztx9iO4lKIFAZx1+563QL5P7hzOEC
36+
kqev90GA8hzD2AXksKEgdOrymAvjq3hSEm0YBN+qS1ldzxYmec0TL7L2wq7lqJnr
37+
kQuZUAG1g2OUYKZ3WSUDvKECgYEAv24NSkFuG/avfiD7w9xtYNCye2KekskROLG2
38+
6FltfsWQTEQDdNkekChaF2WHqRAKwaBlNymRuNZpsuhnMerZCQ9rDWwbDF86RnyA
39+
0MuCr7/kxJQ6XQcY/GnTIydu7F5bOlM0gzqKcW2f6m4fUohczf+0N0QmbDsQAJOi
40+
1lwadgkCgYEA3tkCBJIPTQecfjWiLqSocS6SrwXU+r3Jw6kI3/IB6ban/nsFdHSb
41+
nADST7f2zZatN6XALwsLU7f2R09R39ub0AJPyfToxo7MngR1rvaUYooF3rLlaU32
42+
8DqGvGpLkZkwbtcDmcX1zQoHjUo7RvoShZoapr59ihfrkiiEsXOkuGw=
43+
-----END RSA PRIVATE KEY-----
1444
45+
# Host or URL of the instance of Hyperion
46+
# This url will be especially used for OIDC/OAuth2 discovery endpoint and links send by email
47+
CLIENT_URL: http://127.0.0.1:8000/ # NOTE: A trailing / is required
48+
49+
# Sometimes, when running third services with oidc inside Docker containers, and running Hyperion on your local device
50+
# you may need to use a different url for call made from docker and call made from your device
51+
# For exemple:
52+
# - you will access the login page from your browser http://localhost:8000/auth/authorize
53+
# - but the docker container should call http://host.docker.internal:8000/auth/token and not your localhost address
54+
#OVERRIDDEN_CLIENT_URL_FOR_OIDC: "http://host.docker.internal:8000/" # NOTE: A trailing / is required
55+
56+
# Origins for the CORS middleware. `["http://localhost:3000"]` can be used for development.
57+
# See https://fastapi.tiangolo.com/tutorial/cors/
58+
# It should begin with 'http://' or 'https:// and should never end with a '/'
59+
CORS_ORIGINS:
60+
- https://test-authorized-origin.com
61+
# - "*" # For a local instance, using a wildcard "*" is convenient
62+
# - http://localhost:3000
63+
# - http://127.0.0.1:3000
64+
65+
################
66+
# Auth Clients #
67+
################
68+
69+
# Configure AuthClients, to allow services to authenticate users using OAuth2 or OpenID Connect
70+
# The Python-expected type is `dict[str, AuthClientConfig]` where the class `AuthClientConfig` is from `app.core.utils.config`.
71+
# Thus, the following format should be used in yaml config files:
72+
# ```yml
73+
# AUTH_CLIENTS:
74+
# <ClientId>:
75+
# secret: <ClientSecret> (or <null> to use PKCE instead of a client secret)
76+
# redirect_uri:
77+
# - <RedirectUri1>
78+
# - <RedirectUri2>
79+
# auth_client: <AuthClientClassName>
80+
# ```
81+
# `AuthClientClassName` should be a class from `app.utils.auth.providers`
1582
AUTH_CLIENTS:
1683
AppAuthClientWithPKCE:
84+
secret: null
1785
redirect_uri:
18-
- "http://127.0.0.1:8000/docs"
19-
auth_client: "AppAuthClient"
86+
- http://127.0.0.1:8000/docs
87+
auth_client: AppAuthClient
2088
AppAuthClientWithClientSecret:
21-
secret: "secret"
89+
secret: secret
2290
redirect_uri:
23-
- "http://127.0.0.1:8000/docs"
91+
- http://127.0.0.1:8000/docs
2492
auth_client: "AppAuthClient"
2593
BaseAuthClient:
26-
secret: "secret"
94+
secret: secret
2795
redirect_uri:
28-
- "http://127.0.0.1:8000/docs"
29-
auth_client: "BaseAuthClient"
96+
- http://127.0.0.1:8000/docs
97+
auth_client: BaseAuthClient
3098
RalllyAuthClient:
31-
secret: "secret"
99+
secret: secret
32100
redirect_uri:
33-
- "http://127.0.0.1:8000/docs"
34-
auth_client: "RalllyAuthClient"
101+
- http://127.0.0.1:8000/docs
102+
auth_client: RalllyAuthClient
35103
SynapseAuthClient:
36-
secret: "secret"
104+
secret: secret
37105
redirect_uri:
38-
- "http://127.0.0.1:8000/docs"
39-
auth_client: "SynapseAuthClient"
106+
- http://127.0.0.1:8000/docs
107+
auth_client: SynapseAuthClient
40108
AcceptingOnlyECLUsersAuthClient:
41-
secret: "secret"
109+
secret: secret
42110
redirect_uri:
43-
- "http://127.0.0.1:8000/docs"
44-
auth_client: "NextcloudAuthClient"
111+
- http://127.0.0.1:8000/docs
112+
auth_client: NextcloudAuthClient
45113
RestrictingUsersGroupsAuthClient:
46-
secret: "secret"
114+
secret: secret
47115
redirect_uri:
48-
- "http://127.0.0.1:8000/docs"
49-
auth_client: "DocumensoAuthClient"
116+
- http://127.0.0.1:8000/docs
117+
auth_client: DocumensoAuthClient
50118

51-
# Logging configuration #
119+
#####################
120+
# Hyperion settings #
121+
#####################
52122

53-
LOG_DEBUG_MESSAGES: true
54-
ENABLE_RATE_LIMITER: false
123+
#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)
124+
DATABASE_DEBUG: False # If True, will print all SQL queries in the console
125+
LOG_DEBUG_MESSAGES: True
126+
NB_WORKERS: 6 # Not yet used...
55127

56-
# CORS_ORIGINS should be a list of urls allowed to make requests to the API
57-
# It should begin with 'http://' or 'https:// and should never end with a '/'
58-
CORS_ORIGINS: ["https://test-authorized-origin.com"]
128+
#############
129+
# Factories #
130+
#############
131+
132+
USE_FACTORIES: True # if True and the database is empty, it will be seeded with mocked data
59133

60-
# If True, will print all SQL queries in the console
61-
DATABASE_DEBUG: False
134+
# Configure demo users, to populate the db with your users
135+
# The Python-expected type is `list[UserDemoFactoryConfig]` where the class `UserDemoFactoryConfig` is from `app.core.utils.config`.
136+
# Thus, the following format should be used in yaml config files:
137+
# ```yml
138+
# FACTORIES_DEMO_USERS
139+
# - firstname: <Firstname>
140+
# name: <Name>
141+
# nickname: <Nickname> (or <null>)
142+
143+
# password: <password>
144+
# groups:
145+
# - <UUID value 1 of a GroupType>
146+
# - <UUID value 2 of a GroupType>
147+
# ```
148+
# Group UUIDs should be values of the GroupType enum from `app.core.groups.groupe_type.GroupType`
149+
FACTORIES_DEMO_USERS:
150+
- firstname: Your Firstname
151+
name: Your Name
152+
nickname: Your Nickname
153+
154+
password: Your_P@$$w0rd
155+
groups:
156+
- 0a25cb76-4b63-4fd3-b939-da6d9feabf28 # admin
157+
- 45649735-866a-49df-b04b-a13c74fd5886 # AE
158+
- 1f841bd9-00be-41a7-96e1-860a18a46105 # eclair
159+
- firstname: Foucauld
160+
name: Bellanger
161+
nickname: Ñool
162+
163+
password: azerty
164+
groups:
165+
- 1f841bd9-00be-41a7-96e1-860a18a46105
166+
- 45649735-866a-49df-b04b-a13c74fd5886
167+
- 4ec5ae77-f955-4309-96a5-19cc3c8be71c
62168

169+
#####################################
63170
# SMTP configuration using starttls #
171+
#####################################
172+
64173
SMTP_ACTIVE: False
65174
SMTP_PORT: 587
66175
SMTP_SERVER: ""
67176
SMTP_USERNAME: ""
68177
SMTP_PASSWORD: ""
69178
SMTP_EMAIL: ""
70179

71-
# Push notifications using Firebase Cloud Messaging
72-
USE_FIREBASE: false
180+
##########################
181+
# Firebase Configuration #
182+
##########################
183+
184+
# To enable Firebase push notification capabilities, a JSON key file named `firebase.json` should be placed at Hyperion root.
185+
# This file can be created and downloaded from [Google cloud, IAM and administration, Service account](https://console.cloud.google.com/iam-admin/serviceaccounts) page.
186+
USE_FIREBASE: False
187+
188+
########################
189+
# Matrix configuration #
190+
########################
191+
192+
# Matrix configuration is optional. If configured, Hyperion will be able to send messages to a Matrix server.
193+
# This configuration will be used to send errors messages.
194+
# If the following parameters are not set, logging won't use the Matrix handler
195+
# MATRIX_SERVER_BASE_URL is optional, the official Matrix server will be used if not configured
196+
# Advanced note: Username and password will be used to ask for an access token. A Matrix custom client `Hyperion` is used to make all requests
197+
#MATRIX_SERVER_BASE_URL: "https://matrix.example.org/"
198+
#MATRIX_TOKEN: "mct_..."
199+
#MATRIX_LOG_ERROR_ROOM_ID: "!...:myecl.fr"
200+
#MATRIX_LOG_AMAP_ROOM_ID: ""
201+
202+
#############################
203+
# Token to use the TMDB API #
204+
#############################
205+
206+
# This API key is required in order to send requests to the Internet Movie Database.
207+
# It is only used in the Cinema module.
208+
#THE_MOVIE_DB_API: ""
209+
210+
####################
211+
# S3 configuration #
212+
####################
213+
214+
# S3 configuration is needed to use the S3 storage for MyECLPay logs
215+
216+
#S3_BUCKET_NAME: ""
217+
#S3_ACCESS_KEY_ID: ""
218+
#S3_SECRET_ACCESS_KEY: ""
219+
220+
##############
221+
# Google API #
222+
##############
223+
224+
# Google API configuration #
225+
# Google API is used to upload files to Google Drive
226+
# See ./app/utils/google_api/README.md for more information
227+
#GOOGLE_API_CLIENT_ID: ""
228+
#GOOGLE_API_CLIENT_SECRET: ""
229+
230+
#RAID_DRIVE_REFRESH_TOKEN: ""
231+
#RAID_DRIVE_API_KEY: ""
232+
#RAID_DRIVE_CLIENT_ID: ""
233+
#RAID_DRIVE_CLIENT_SECRET: ""
234+
#RAID_PAYMENT_REDIRECTION_URL: ""
235+
236+
###########################
237+
# HelloAsso configuration #
238+
###########################
73239

74-
# Payment configuration #
240+
# To be able to use payment features using HelloAsso, you need to set a client id, secret for their API
241+
# HelloAsso provide a sandbox to be able to realize tests
242+
# HELLOASSO_API_BASE should have the format: `api.helloasso-sandbox.com`
243+
# HelloAsso only allow 20 simultaneous active access token. Note that each Hyperion worker will need its own access token.
75244

76-
TRUSTED_PAYMENT_REDIRECT_URLS: ["http://localhost:3000/payment_callback"]
245+
HELLOASSO_CONFIGURATIONS: # [["name", "helloasso_client_id", "helloasso_client_secret", "helloasso_slug", "redirection_uri"]]
246+
# MYECLPAY:
247+
# helloasso_client_id: ...
248+
# helloasso_client_secret: ...
249+
# helloasso_slug: "AEECL"
250+
# redirection_uri: null
251+
HELLOASSO_API_BASE: api.helloasso-sandbox.com
77252

78-
HELLOASSO_API_BASE: "https://api.helloasso.com/v3"
79-
HELLOASSO_CONFIGURATIONS: {}
253+
# Maximum wallet balance for MyECLPay in cents, we will prevent user from adding more money to their wallet if it will make their balance exceed this value
254+
MYECLPAY_MAXIMUM_WALLET_BALANCE: 8000
80255

81-
MYECLPAY_MAXIMUM_WALLET_BALANCE: 5000
256+
# Trusted urls is a list of redirect payment url that can be trusted by Hyperion.
257+
# These urls will be used to validate the redirect url provided by the front
258+
TRUSTED_PAYMENT_REDIRECT_URLS:
259+
- http://localhost:3000/payment_callback
260+
# MyECLPay requires an external service to recurrently check for transactions and state integrity, this service needs an access to all the data related to the transactions and the users involved
261+
# This service will use a special token to access the data
262+
# If this token is not set, the service will not be able to access the data and no integrity check will be performed
263+
#MYECLPAY_DATA_VERIFIER_ACCESS_TOKEN: ""

0 commit comments

Comments
 (0)