-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clear separation of Veilid Testing parts
- Loading branch information
1 parent
287e84b
commit 9a3ab55
Showing
7 changed files
with
9 additions
and
101 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
flask==2.3.2 | ||
flask_shell2http==1.9.1 | ||
veilid==0.2.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,4 @@ | ||
#!/usr/bin/env bash | ||
|
||
export PATH="/root/.local/bin:${PATH}" | ||
export FLASK_APP=veilid | ||
/veilid/veilid-server -c /veilid/veilid-server.conf --debug & | ||
flask run -p 4000 --host=0.0.0.0 | ||
/veilid/veilid-server -c /veilid/veilid-server.conf --debug | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,93 +0,0 @@ | ||
# stdlib | ||
import functools | ||
import os | ||
from typing import Any | ||
from typing import Callable | ||
from typing import Type | ||
|
||
# third party | ||
from flask import Flask | ||
from flask_executor import Executor | ||
from flask_shell2http import Shell2HTTP | ||
|
||
# Flask application instance | ||
app = Flask(__name__) | ||
|
||
executor = Executor(app) | ||
shell2http = Shell2HTTP(app=app, executor=executor, base_url_prefix="/commands/") | ||
|
||
# key = os.environ.get("STACK_API_KEY", None) # Get key from environment | ||
# if key is None: | ||
# print("No STACK_API_KEY found, exiting.") | ||
# sys.exit(1) | ||
|
||
|
||
def check_stack_api_key(challenge_key: str) -> bool: | ||
key = os.environ.get("STACK_API_KEY", None) # Get key from environment | ||
if key is None: | ||
return False | ||
if challenge_key == key: | ||
return True | ||
return False | ||
|
||
|
||
def basic_auth_check(f: Any) -> Callable: | ||
@functools.wraps(f) | ||
def inner_decorator(*args: Any, **kwargs: Any) -> Type: | ||
# stack_api_key = request.headers.get("X-STACK-API-KEY", "") | ||
# if not check_stack_api_key(challenge_key=stack_api_key): | ||
# raise Exception("STACK_API_KEY doesn't match.") | ||
return f(*args, **kwargs) | ||
|
||
return inner_decorator | ||
|
||
|
||
# def down_callback(context: Dict, future: Future) -> None: | ||
# # optional user-defined callback function | ||
# print(context, future.result()) | ||
|
||
|
||
# def up_callback(context: Dict, future: Future) -> None: | ||
# # optional user-defined callback function | ||
# print(context, future.result()) | ||
|
||
|
||
# shell2http.register_command( | ||
# endpoint="down", | ||
# command_name="tailscale down", | ||
# callback_fn=down_callback, | ||
# decorators=[basic_auth_check], | ||
# ) | ||
|
||
# shell2http.register_command( | ||
# endpoint="up", | ||
# command_name="tailscale up", | ||
# callback_fn=up_callback, | ||
# decorators=[basic_auth_check], | ||
# ) | ||
|
||
|
||
# def status_callback(context: Dict, future: Future) -> None: | ||
# # optional user-defined callback function | ||
# print(context, future.result()) | ||
|
||
|
||
# shell2http.register_command( | ||
# endpoint="status", | ||
# command_name="tailscale status", | ||
# callback_fn=status_callback, | ||
# decorators=[basic_auth_check], | ||
# ) | ||
|
||
|
||
# def debug_prefs_callback(context: Dict, future: Future) -> None: | ||
# # optional user-defined callback function | ||
# print(context, future.result()) | ||
|
||
|
||
# shell2http.register_command( | ||
# endpoint="debug", | ||
# command_name="tailscale debug prefs", | ||
# callback_fn=debug_prefs_callback, | ||
# decorators=[basic_auth_check], | ||
# ) | ||