Commit Graph

1069 Commits

Author SHA1 Message Date
Albert Copeland
155ae7e84c Merge pull request #89 from MarekPikula/fix_env_validators
Fix environment validators
2023-04-22 14:46:58 +09:00
Marek Pikuła
0ae21b444c Set valid empty defaults for AUTH_TYPE and BUILD_DATE
Signed-off-by: Marek Pikuła <marek.pikula@embevity.com>
2023-04-22 05:36:46 +00:00
Marek Pikuła
3acfa64f11 Use ISO format for BUILD_DATE in Jenkins
Signed-off-by: Marek Pikuła <marek.pikula@embevity.com>
2023-04-22 05:36:03 +00:00
Marek Pikuła
3be00b83ac Make the BUILD_DATE validator more general
It should be more permissive and fall back to current time if format
error is detected,

Signed-off-by: Marek Pikuła <marek.pikula@embevity.com>
2023-04-22 05:34:05 +00:00
Marek Pikuła
a5bd6d2f7e Use Pydantic validation error message in logs
Should give better insight into the validation error.

Signed-off-by: Marek Pikuła <marek.pikula@embevity.com>
2023-04-22 05:31:40 +00:00
Marek Pikuła
7296c5d9e0 Make the AUTH_TYPE validator more general
- allow any casing style
- use Basic th by default if the string is left empty
- set some default values for user-password pair for BasicAuth

Signed-off-by: Marek Pikuła <marek.pikula@embevity.com>
2023-04-22 05:30:58 +00:00
iFargle
0aa0257b6e test 2023-04-22 13:02:53 +09:00
iFargle
0bffa71de2 test 2023-04-21 22:09:41 +09:00
Albert Copeland
9aeea628d2 Update pyproject.toml 2023-04-21 19:53:37 +09:00
iFargle
128c5d1d76 Update version v0.7.0 2023-04-21 19:31:16 +09:00
Albert Copeland
5097807385 Merge pull request #86 from MarekPikula/improve_code_style
Improve code style
2023-04-21 19:29:15 +09:00
Marek Pikuła
d4169f1af4 For now, disable pylint warnings in renderer
To be revisited in future.

Signed-off-by: Marek Pikuła <marek.pikula@embevity.com>
2023-04-21 06:31:51 +00:00
Marek Pikuła
fa86bbf00d Fix CI lint path
Signed-off-by: Marek Pikuła <marek.pikula@embevity.com>
2023-04-21 06:23:25 +00:00
Marek Pikuła
3cc8d4bc4f Disable fixme for pylint CI check
Signed-off-by: Marek Pikuła <marek.pikula@embevity.com>
2023-04-21 06:19:13 +00:00
Marek Pikuła
44f6f1526c Add VS Code launch targets
Signed-off-by: Marek Pikuła <marek.pikula@embevity.com>
2023-04-21 06:02:29 +00:00
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
20a4c9d3f6 Add some extensions and enable Python linting in devcontainer
Signed-off-by: Marek Pikuła <marek.pikula@embevity.com>
2023-04-21 05:50:28 +00:00
Marek Pikuła
5eaa796ba3 Add Github Workflow for linters
Signed-off-by: Marek Pikuła <marek.pikula@embevity.com>
2023-04-21 05:50:28 +00:00
Marek Pikuła
142a97d723 Add more pre-commit hooks
Signed-off-by: Marek Pikuła <marek.pikula@embevity.com>
2023-04-21 05:50:28 +00:00
Marek Pikuła
64bac3b440 Add Poetry local config 2023-04-21 05:50:28 +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
Marek Pikuła
4919147483 Add pre-commit hooks
Signed-off-by: Marek Pikuła <marek.pikula@embevity.com>
2023-04-21 05:50:28 +00:00
Marek Pikuła
19f27eb552 Add basic devcontainer configuration
Signed-off-by: Marek Pikuła <marek.pikula@embevity.com>
2023-04-21 05:50:28 +00:00
Marek Pikuła
74b53cad21 Add more development tools
- black
- isort
- ruff
- pre-comit
- mypy
- pydocstyle

Signed-off-by: Marek Pikuła <marek.pikula@embevity.com>
2023-04-21 05:50:28 +00:00
Marek Pikuła
8158d7cf7d Import Python gitignore from toptal
Signed-off-by: Marek Pikuła <marek.pikula@embevity.com>
2023-04-21 05:50:28 +00:00
Albert Copeland
6ef80d061c Merge pull request #85 from itbencn/add-machine-bug
fix add_machine bug & foramt
2023-04-21 11:18:13 +09:00
itbencn
2fdbbf5519 fix add_machine bug & foramt 2023-04-21 01:28:56 +08:00
Albert Copeland
e7c1596e3a Merge pull request #83 from rohow/main
fix(logger):  Field reference error
2023-04-14 19:54:14 +09:00
rohow
48db591d25 fix(logger): Field reference error
Fix the error when the server_url in config is not configured.
2023-04-14 17:45:41 +08:00
Albert Copeland
3934c3b2cf Merge pull request #70 from MarekPikula/fix/remove_introspection_endpoint
Remove introspection_endpoint from required secrets
v0.6.1
2023-04-03 08:18:57 +09:00
Albert Copeland
bd22ff6624 Merge pull request #71 from iFargle/redo-routes-index
Redo routes index
2023-04-03 08:18:33 +09:00
Marek Pikuła
df6f337a25 Remove introspection_endpoint from required secrets
The field is not mandatory and some OIDC providers (such as Nextcloud)
don't provide it resulting in a key error.

Also, refactored client secrets to use json.dumps() for better code
readibility.

Signed-off-by: Marek Pikuła <marek@serenitycode.dev>
2023-04-02 20:17:52 +02:00
iFargle
19a229c595 test 2023-04-02 10:05:29 +09:00
iFargle
04deed6b73 Update app versions 2023-04-02 08:50:36 +09:00
iFargle
35c8dda9ef test 2023-04-02 08:39:43 +09:00
iFargle
bc2f920805 test 2023-04-02 08:35:13 +09:00
iFargle
d8e1a9bdad breakin' things 2023-04-02 08:27:35 +09:00
Albert Copeland
87d39e85a6 Merge pull request #64 from iFargle/inpage-search
v0.6.0
v0.6.0
2023-03-30 14:14:42 +09:00
Albert Copeland
7cef7f4ab3 Merge branch 'main' into inpage-search 2023-03-30 14:04:18 +09:00
iFargle
3488639f9a Fix screenshots 2023-03-30 14:02:28 +09:00
iFargle
8501da1387 Final update for 0.6.0 2023-03-30 13:46:55 +09:00
iFargle
56d8ed25ad test 2023-03-30 13:20:18 +09:00
iFargle
77c50dd130 test 2023-03-30 13:16:31 +09:00
iFargle
106c855d2a test 2023-03-30 13:13:26 +09:00
iFargle
a87419cbff test 2023-03-30 13:01:59 +09:00
iFargle
3978c86c92 test 2023-03-30 12:57:35 +09:00
iFargle
68b177a379 lol 2023-03-30 12:49:06 +09:00
iFargle
316183cb1f test 2023-03-30 12:40:37 +09:00
iFargle
d07c19902d test 2023-03-30 12:33:37 +09:00
iFargle
f7b3bdd824 test 2023-03-30 12:29:07 +09:00