Commit Graph

81 Commits

Author SHA1 Message Date
Marek Pikuła
fe7a3667d4 Complete the major refactor
Major part of #73

Unfortunately, it wasn't possible to split it to multiple smaller
commits, since the changes touched the entire application substantially.
Here is a short list of major changes:

1. Create a separate library (headscale-api), which is used as a
   convenient abstraction layer providing Pythonic interface with
   Pydantic. Headscale API is fully asynchronous library, benefitting
   from improved concurrency for backend requests thus increasing page
   load speed, e.g., on "Machines" page.
2. Create a common common, validated with flask-pydantic API passthrough
   layer from GUI to the backend.
3. Move authentication to a separate (auth.py), consolidating the
   functionality in a single place (with better place for expansion in
   the future).
4. Move configuration management to a separate module (config.py). Use
   Pydantic's BaseSettings for reading values from environment, with
   extensive validation and error reporting.
5. Reduce the number of health checks.
    - Now, most are performed during server initialization. If any test
      fails, the server is started in tainted mode, with only the error
      page exposed (thus reducing the surface of attack in invalid
      state).
    - Key checks are implicit in the requests to the backend and
      guarded by `@headscale.key_check_guard` decorator.
    - Key renewal is moved to server-side scheduler.
6. Introduce type hints to the level satisfactory for mypy static
   analysis. Also, enable some other linters in CI and add optional
   pre-commit hooks.
7. Properly handle some error states. Instead of returning success and
   handling different responses, if something fails, there is HTTP error
   code and standard response for it.
8. General formatting, small rewrites for clarity and more idiomatic
   Python constructs.

Signed-off-by: Marek Pikuła <marek.pikula@embevity.com>
2023-04-21 06:02:29 +00:00
Marek Pikuła
358c0086af Apply black and isort auto formatting
Signed-off-by: Marek Pikuła <marek.pikula@embevity.com>
2023-04-21 05:50:28 +00:00
iFargle
780d01689e test 2023-03-22 20:35:11 +09:00
iFargle
12f944426f Add logging 2023-02-28 14:26:46 +09:00
iFargle
37f74ac82d More logging configs 2023-02-28 14:24:46 +09:00
iFargle
8e6d84d36a Update app version for final tsts 2023-02-28 13:29:31 +09:00
iFargle
c94e3f0002 Test 2023-02-28 13:07:07 +09:00
iFargle
90e364d11d Trying create_logger 2023-02-28 08:28:09 +09:00
iFargle
0fec4852af test 2023-02-27 22:49:34 +09:00
iFargle
88afde359a test 2023-02-27 22:45:12 +09:00
iFargle
bdbb85bcb9 Test 2023-02-27 22:21:51 +09:00
iFargle
3833a33885 test 2023-02-27 22:03:04 +09:00
iFargle
b3fac98c1c test 2023-02-27 21:54:36 +09:00
iFargle
3db9ed8635 Test 2023-02-27 21:33:06 +09:00
iFargle
be78e2bfdf test 2023-02-27 21:24:37 +09:00
iFargle
9d01a05263 Test 2023-02-27 21:19:12 +09:00
iFargle
aea36e358b Testing more logging 2023-02-27 21:15:58 +09:00
iFargle
3808720800 Testing logging 2023-02-27 20:15:44 +09:00
iFargle
f7dc20601f test 2023-02-22 22:20:36 +09:00
iFargle
18377b8daa test 2023-02-22 22:01:18 +09:00
iFargle
e70f4ddd9c Test 2023-02-22 21:34:35 +09:00
iFargle
7f3b472d5b test 2023-02-22 18:59:52 +09:00
iFargle
129e167a20 Add pretty print duration for positive time 2023-02-22 18:02:47 +09:00
iFargle
071b53f04b test 2023-02-21 10:16:50 +09:00
iFargle
633d90ab8d Test 2023-02-21 10:00:04 +09:00
iFargle
437b46d9d8 test 2023-02-21 08:07:24 +09:00
iFargle
2376d94f90 test 2023-02-21 08:01:58 +09:00
iFargle
ef8e7f0644 test 2023-02-20 17:23:05 +09:00
iFargle
a0a62c4af6 Updates 2023-02-17 22:41:41 +09:00
iFargle
cf3189d5d4 test 2023-02-17 22:24:58 +09:00
iFargle
d60bcc6286 consistency is key 2023-02-16 21:58:19 +09:00
iFargle
57cb93453a Typo 2023-02-16 21:57:46 +09:00
iFargle
02bfc9885f test 2023-02-16 21:50:00 +09:00
iFargle
83faf9283d test 2023-02-16 21:48:05 +09:00
iFargle
5d12fa1369 Update 2023-02-16 21:45:21 +09:00
iFargle
032a08ed52 test 2023-02-16 21:39:54 +09:00
iFargle
cf12e5b5f4 Test 2023-02-16 21:30:49 +09:00
iFargle
ceefa1450f test 2023-02-16 20:55:05 +09:00
iFargle
84320215b8 test 2023-02-16 20:46:51 +09:00
iFargle
f77472653a Tseting basic/oidc auth 2023-02-16 20:17:36 +09:00
iFargle
2754e568ee Remove unused dependencies and variables 2023-02-16 00:06:31 +09:00
iFargle
ba5ab5e090 Clean up code before push to main 2023-02-15 20:58:27 +09:00
iFargle
32eee7acd4 Fix typo 2023-02-15 20:47:20 +09:00
iFargle
60b17c9849 Add more checks 2023-02-15 20:45:51 +09:00
iFargle
486cea3de1 Test 2023-02-15 20:33:47 +09:00
iFargle
74e4ce529e test 2023-02-15 20:33:25 +09:00
iFargle
8a1e04904f Update errors 2023-02-15 20:27:30 +09:00
iFargle
2542e0e082 Test 2023-02-15 20:22:15 +09:00
iFargle
0f0e957f7e Add logging 2023-02-15 20:14:42 +09:00
iFargle
4dc862e45b Add logging 2023-02-15 20:13:27 +09:00