diff --git a/.gitignore b/.gitignore index df3855a4..5f9615d4 100644 --- a/.gitignore +++ b/.gitignore @@ -47,4 +47,4 @@ weaviate_data/ codegate.db # certificate directory -certs/ +*certs/ diff --git a/cert_gen.py b/cert_gen.py deleted file mode 100644 index 4761505e..00000000 --- a/cert_gen.py +++ /dev/null @@ -1,178 +0,0 @@ -import datetime -import os - -from cryptography import x509 -from cryptography.hazmat.primitives import hashes, serialization -from cryptography.hazmat.primitives.asymmetric import rsa -from cryptography.x509.oid import ExtendedKeyUsageOID, NameOID - - -def generate_certificates(cert_dir="certs"): - """Generate self-signed certificates with proper extensions for HTTPS proxy""" - # Create certificates directory if it doesn't exist - if not os.path.exists(cert_dir): - print("Making: ", cert_dir) - os.makedirs(cert_dir) - - # Generate private key - ca_private_key = rsa.generate_private_key( - public_exponent=65537, - key_size=4096, # Increased key size for better security - ) - - # Generate public key - ca_public_key = ca_private_key.public_key() - - # CA BEGIN - name = x509.Name( - [ - x509.NameAttribute(NameOID.COMMON_NAME, "Proxy Pilot CA"), - x509.NameAttribute(NameOID.ORGANIZATION_NAME, "Proxy Pilot"), - x509.NameAttribute(NameOID.ORGANIZATIONAL_UNIT_NAME, "Development"), - x509.NameAttribute(NameOID.COUNTRY_NAME, "UK"), - ] - ) - - builder = x509.CertificateBuilder() - builder = builder.subject_name(name) - builder = builder.issuer_name(name) - builder = builder.public_key(ca_public_key) - builder = builder.serial_number(x509.random_serial_number()) - builder = builder.not_valid_before(datetime.datetime.utcnow()) - builder = builder.not_valid_after( - datetime.datetime.utcnow() + datetime.timedelta(days=3650) # 10 years - ) - - builder = builder.add_extension( - x509.BasicConstraints(ca=True, path_length=None), - critical=True, - ) - - builder = builder.add_extension( - x509.KeyUsage( - digital_signature=True, - content_commitment=False, - key_encipherment=True, - data_encipherment=False, - key_agreement=False, - key_cert_sign=True, # This is a CA - crl_sign=True, - encipher_only=False, - decipher_only=False, - ), - critical=True, - ) - - ca_cert = builder.sign( - private_key=ca_private_key, - algorithm=hashes.SHA256(), - ) - - # Save CA certificate and key - - with open("certs/ca.crt", "wb") as f: - f.write(ca_cert.public_bytes(serialization.Encoding.PEM)) - - with open("certs/ca.key", "wb") as f: - f.write( - ca_private_key.private_bytes( - encoding=serialization.Encoding.PEM, - format=serialization.PrivateFormat.PKCS8, - encryption_algorithm=serialization.NoEncryption(), - ) - ) - # CA END - - # SERVER BEGIN - - # Generate new certificate for domain - server_key = rsa.generate_private_key( - public_exponent=65537, - key_size=2048, # 2048 bits is sufficient for domain certs - ) - - name = x509.Name( - [ - x509.NameAttribute(NameOID.COMMON_NAME, "Proxy Pilot CA"), - x509.NameAttribute(NameOID.ORGANIZATION_NAME, "Proxy Pilot Generated"), - ] - ) - - builder = x509.CertificateBuilder() - builder = builder.subject_name(name) - builder = builder.issuer_name(ca_cert.subject) - builder = builder.public_key(server_key.public_key()) - builder = builder.serial_number(x509.random_serial_number()) - builder = builder.not_valid_before(datetime.datetime.utcnow()) - builder = builder.not_valid_after(datetime.datetime.utcnow() + datetime.timedelta(days=365)) - - # Add domain to SAN - builder = builder.add_extension( - x509.SubjectAlternativeName([x509.DNSName("localhost")]), - critical=False, - ) - - # Add extended key usage - builder = builder.add_extension( - x509.ExtendedKeyUsage( - [ - ExtendedKeyUsageOID.SERVER_AUTH, - ExtendedKeyUsageOID.CLIENT_AUTH, - ] - ), - critical=False, - ) - - # Basic constraints (not a CA) - builder = builder.add_extension( - x509.BasicConstraints(ca=False, path_length=None), - critical=True, - ) - - certificate = builder.sign( - private_key=ca_private_key, - algorithm=hashes.SHA256(), - ) - - with open("certs/server.crt", "wb") as f: - f.write(certificate.public_bytes(serialization.Encoding.PEM)) - - with open("certs/server.key", "wb") as f: - f.write( - server_key.private_bytes( - encoding=serialization.Encoding.PEM, - format=serialization.PrivateFormat.PKCS8, - encryption_algorithm=serialization.NoEncryption(), - ) - ) - - print("Certificates generated successfully in the 'certs' directory") - print("\nTo trust these certificates:") - print("\nOn macOS:") - print( - "sudo security add-trusted-cert -d -r trustRoot " - "-k /Library/Keychains/System.keychain certs/server.crt" - ) - print("\nOn Windows (PowerShell as Admin):") - print( - 'Import-Certificate -FilePath "certs\\server.crt" ' - '-CertStoreLocation Cert:\\LocalMachine\\Root' - ) - print("\nOn Linux:") - print("sudo cp certs/server.crt /usr/local/share/ca-certificates/proxy-pilot.crt") - print("sudo update-ca-certificates") - print("\nFor VSCode, add to settings.json:") - print( - """{ - "http.proxy": "https://localhost:8989", - "http.proxySupport": "on", - "github.copilot.advanced": { - "debug.testOverrideProxyUrl": "https://localhost:8989", - "debug.overrideProxyUrl": "https://localhost:8989" - } -}""" - ) - - -if __name__ == "__main__": - generate_certificates() diff --git a/docs/cli.md b/docs/cli.md index 123e75d6..6be81b79 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -29,10 +29,12 @@ codegate serve [OPTIONS] - Overrides configuration file and environment variables - `--log-level [ERROR|WARNING|INFO|DEBUG]`: Set the log level (default: INFO) + - Optional - Case-insensitive - Overrides configuration file and environment variables - `--log-format [JSON|TEXT]`: Set the log format (default: JSON) + - Optional - Case-insensitive - Overrides configuration file and environment variables @@ -72,6 +74,10 @@ codegate serve [OPTIONS] - `--embedding-model TEXT`: Name of the model used for embeddings - Optional +- `--db-path TEXT`: Path to a SQLite DB. It will create one if it doesn't exist. (default: ./codegate_volume/db/codegate.db) + - Optional + - Overrides configuration file and environment variables + ### show-prompts Display the loaded system prompts: @@ -87,6 +93,46 @@ codegate show-prompts [OPTIONS] - Must be a valid YAML file - If not provided, shows default prompts from prompts/default.yaml +### generate_certs + +Generate certificates for the CodeGate server. + +```bash +codegate generate-certs [OPTIONS] +``` + +#### Options + +- `--certs-out-dir PATH`: Directory path where the certificates are going to be generated. (default: ./codegate_volume/certs) + - Optional + - Overrides configuration file and environment variables + +- `--ca-cert-name TEXT`: Name that will be given to the created CA certificate. (default: ca.crt) + - Optional + - Overrides configuration file and environment variables + +- `--ca-key-name TEXT`: Name that will be given to the created CA key. (default: ca.key) + - Optional + - Overrides configuration file and environment variables + +- `--server-cert-name TEXT`: Name that will be given to the created server certificate. (default: server.crt) + - Optional + - Overrides configuration file and environment variables + +- `--server-key-name TEXT`: Name that will be given to the created server key. (default: server.key) + - Optional + - Overrides configuration file and environment variables + +- `--log-level [ERROR|WARNING|INFO|DEBUG]`: Set the log level (default: INFO) + - Optional + - Case-insensitive + - Overrides configuration file and environment variables + +- `--log-format [JSON|TEXT]`: Set the log format (default: JSON) + - Optional + - Case-insensitive + - Overrides configuration file and environment variables + ## Error Handling The CLI provides user-friendly error messages for: @@ -144,3 +190,9 @@ codegate show-prompts Show prompts from a custom file: ```bash codegate show-prompts --prompts my-prompts.yaml +``` + +Generate certificates with default settings: +```bash +codegate generate-certs +``` \ No newline at end of file diff --git a/poetry.lock b/poetry.lock index c76d4487..0192704a 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.4 and should not be changed by hand. [[package]] name = "aiohappyeyeballs" diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh index fe73faeb..120ce499 100755 --- a/scripts/entrypoint.sh +++ b/scripts/entrypoint.sh @@ -7,6 +7,7 @@ BACKUP_PATH="/tmp/weaviate_backup" BACKUP_NAME="backup" MODEL_BASE_PATH="/app/codegate_volume/models" CODEGATE_DB_FILE="/app/codegate_volume/db/codegate.db" +CODEGATE_CERTS="/app/codegate_volume/certs" # Function to restore backup if paths are provided restore_backup() { @@ -22,6 +23,11 @@ restore_backup() { fi } +genrerate_certs() { + echo "Generating certificates..." + python -m src.codegate.cli generate-certs --certs-out-dir "$CODEGATE_CERTS" +} + # Function to start Nginx server for the dashboard start_dashboard() { echo "Starting the dashboard..." @@ -54,8 +60,11 @@ echo "Initializing entrypoint script..." # Step 1: Restore backup if applicable restore_backup -# Step 2: Start the dashboard +# Step 2: Generate certificates +genrerate_certs + +# Step 3: Start the dashboard start_dashboard -# Step 3: Start the main application +# Step 4: Start the main application start_application \ No newline at end of file diff --git a/src/codegate/ca/codegate_ca.py b/src/codegate/ca/codegate_ca.py index 5f33810d..4a8315d6 100644 --- a/src/codegate/ca/codegate_ca.py +++ b/src/codegate/ca/codegate_ca.py @@ -297,7 +297,7 @@ def generate_certificates(self) -> Tuple[str, str]: # CA generated, now generate server certificate - # Generate new certificate for domain + ## Generate new certificate for domain logger.debug("Generating private key for server") server_key = rsa.generate_private_key( public_exponent=65537, @@ -369,31 +369,34 @@ def generate_certificates(self) -> Tuple[str, str]: ) # Print instructions for trusting the certificates - print("Certificates generated successfully in the 'certs' directory") - print("\nTo trust these certificates:") - print("\nOn macOS:") - print( - "`sudo security add-trusted-cert -d -r trustRoot " - "-k /Library/Keychains/System.keychain certs/ca.crt" - ) - print("\nOn Windows (PowerShell as Admin):") - print( - 'Import-Certificate -FilePath "certs\\ca.crt" ' - '-CertStoreLocation Cert:\\LocalMachine\\Root' - ) - print("\nOn Linux:") - print("sudo cp certs/ca.crt /usr/local/share/ca-certificates/codegate.crt") - print("sudo update-ca-certificates") - print("\nFor VSCode, add to settings.json:") - print( - """{ + logger.info( + """ +Certificates generated successfully in the 'certs' directory +To trust these certificates: + +On macOS: +`sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain certs/ca.crt` + +On Windows (PowerShell as Admin): +`Import-Certificate -FilePath "certs\\ca.crt" -CertStoreLocation Cert:\\LocalMachine\\Root` + +On Linux: +`sudo cp certs/ca.crt /usr/local/share/ca-certificates/codegate.crt` +`sudo update-ca-certificates` + +For VSCode, add to settings.json: +{ "http.proxy": "https://localhost:8990", + "http.proxyStrictSSL": true, "http.proxySupport": "on", "github.copilot.advanced": { + "debug.useNodeFetcher": true, + "debug.useElectronFetcher": true, "debug.testOverrideProxyUrl": "https://localhost:8990", "debug.overrideProxyUrl": "https://localhost:8990" - } -}""" + }, +} +""" ) logger.debug("Certificates generated successfully") return server_cert, server_key @@ -434,10 +437,9 @@ def ensure_certificates_exist(self) -> None: logger.debug("Certificates not found, generating new certificates") self.generate_certificates() else: - logger.debug( - f"Certificates found at: {Config.get_config().server_cert} " - "and {Config.get_config().server_key}" - ) + server_cert = Config.get_config().server_cert + server_key = Config.get_config().server_key + logger.debug(f"Certificates found at: {server_cert} and {server_key}.") def get_ssl_context(self) -> ssl.SSLContext: """Get SSL context with certificates""" diff --git a/src/codegate/cli.py b/src/codegate/cli.py index 8ed5b62e..297aedda 100644 --- a/src/codegate/cli.py +++ b/src/codegate/cli.py @@ -403,6 +403,72 @@ def restore_backup(backup_path: Path, backup_name: str) -> None: sys.exit(1) +@cli.command() +@click.option( + "--certs-out-dir", + type=click.Path(exists=False, file_okay=False, path_type=Path), + help="Directory path where the certificates are going to be generated.", +) +@click.option( + "--ca-cert-name", + type=str, + default=None, + help="Name that will be given to the created ca-cert.", +) +@click.option( + "--ca-key-name", + type=str, + default=None, + help="Name that will be given to the created ca-key.", +) +@click.option( + "--server-cert-name", + type=str, + default=None, + help="Name that will be given to the created server-cert.", +) +@click.option( + "--server-key-name", + type=str, + default=None, + help="Name that will be given to the created server-key.", +) +@click.option( + "--log-level", + type=click.Choice([level.value for level in LogLevel]), + default=None, + help="Set the log level (default: INFO)", +) +@click.option( + "--log-format", + type=click.Choice([fmt.value for fmt in LogFormat], case_sensitive=False), + default=None, + help="Set the log format (default: JSON)", +) +def generate_certs( + certs_out_dir: Optional[Path], + ca_cert_name: Optional[str], + ca_key_name: Optional[str], + server_cert_name: Optional[str], + server_key_name: Optional[str], + log_level: Optional[str], + log_format: Optional[str], +) -> None: + """Generate certificates for the codegate server.""" + cfg = Config.load( + certs_dir=certs_out_dir, + ca_cert=ca_cert_name, + ca_key=ca_key_name, + server_cert=server_cert_name, + server_key=server_key_name, + cli_log_level=log_level, + cli_log_format=log_format, + ) + setup_logging(cfg.log_level, cfg.log_format) + ca = CertificateAuthority.get_instance() + ca.generate_certificates() + + def main() -> None: """Main entry point for the CLI.""" cli() diff --git a/src/codegate/config.py b/src/codegate/config.py index 59ec9d86..45c634b7 100644 --- a/src/codegate/config.py +++ b/src/codegate/config.py @@ -45,7 +45,7 @@ class Config: db_path: Optional[str] = None # Certificate configuration - certs_dir: str = "./certs" + certs_dir: str = "./codegate_volume/certs" ca_cert: str = "ca.crt" ca_key: str = "ca.key" server_cert: str = "server.crt" @@ -325,6 +325,16 @@ def load( config.server_key = server_key if db_path is not None: config.db_path = db_path + if certs_dir is not None: + config.certs_dir = certs_dir + if ca_cert is not None: + config.ca_cert = ca_cert + if ca_key is not None: + config.ca_key = ca_key + if server_cert is not None: + config.server_cert = server_cert + if server_key is not None: + config.server_key = server_key # Set the __config class attribute Config.__config = config diff --git a/src/codegate/pipeline/secrets/secrets.py b/src/codegate/pipeline/secrets/secrets.py index 01eb40e6..e605f18b 100644 --- a/src/codegate/pipeline/secrets/secrets.py +++ b/src/codegate/pipeline/secrets/secrets.py @@ -239,7 +239,7 @@ def _find_complete_redaction(self, text: str) -> tuple[Optional[re.Match[str]], # Get the first complete match match = matches[0] - return match, text[match.end():] + return match, text[match.end() :] async def process_chunk( self, diff --git a/src/codegate/providers/copilot/provider.py b/src/codegate/providers/copilot/provider.py index a6b26f8c..31b9bfcf 100644 --- a/src/codegate/providers/copilot/provider.py +++ b/src/codegate/providers/copilot/provider.py @@ -209,7 +209,7 @@ async def handle_http_request(self): self.log_decrypted_data(body, "Request Body") for i in range(0, len(body), CHUNK_SIZE): - chunk = body[i: i + CHUNK_SIZE] + chunk = body[i : i + CHUNK_SIZE] self.target_transport.write(chunk) else: logger.debug("=" * 40) @@ -443,7 +443,7 @@ async def get_target_url(cls, path: str) -> Optional[str]: # Then check for prefix match for route in VALIDATED_ROUTES: # For prefix matches, keep the rest of the path - remaining_path = path[len(route.path):] + remaining_path = path[len(route.path) :] logger.debug(f"Remaining path: {remaining_path}") # Make sure we don't end up with double slashes if remaining_path and remaining_path.startswith("/"): diff --git a/tests/test_cli.py b/tests/test_cli.py index 2d7b5906..b91e7025 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,7 +1,5 @@ """Tests for the CLI module.""" -import asyncio -import signal from pathlib import Path from typing import Any, AsyncGenerator from unittest.mock import AsyncMock, MagicMock, patch @@ -11,8 +9,6 @@ from uvicorn.config import Config as UvicornConfig from codegate.cli import UvicornServer, cli -from codegate.codegate_logging import LogFormat, LogLevel -from codegate.config import DEFAULT_PROVIDER_URLS @pytest.fixture @@ -73,8 +69,8 @@ def test_cli_version(cli_runner: CliRunner) -> None: assert result.exit_code == 0 -#@pytest.mark.asyncio -#async def test_uvicorn_server_serve(mock_uvicorn_server: UvicornServer) -> None: +# @pytest.mark.asyncio +# async def test_uvicorn_server_serve(mock_uvicorn_server: UvicornServer) -> None: # """Test UvicornServer serve method.""" # # Start server in background task # server_task = asyncio.create_task(mock_uvicorn_server.serve()) @@ -90,8 +86,8 @@ def test_cli_version(cli_runner: CliRunner) -> None: # await server_task -#@pytest.mark.asyncio -#async def test_uvicorn_server_cleanup(mock_uvicorn_server: UvicornServer) -> None: +# @pytest.mark.asyncio +# async def test_uvicorn_server_cleanup(mock_uvicorn_server: UvicornServer) -> None: # """Test UvicornServer cleanup method.""" # # Start server # server_task = asyncio.create_task(mock_uvicorn_server.serve()) @@ -107,8 +103,8 @@ def test_cli_version(cli_runner: CliRunner) -> None: # await server_task -#@pytest.mark.asyncio -#async def test_uvicorn_server_signal_handling(mock_uvicorn_server: UvicornServer) -> None: +# @pytest.mark.asyncio +# async def test_uvicorn_server_signal_handling(mock_uvicorn_server: UvicornServer) -> None: # """Test signal handling in UvicornServer.""" # # Mock signal handlers # with patch("asyncio.get_running_loop") as mock_loop: @@ -143,11 +139,11 @@ def test_serve_default_options( result = cli_runner.invoke(cli, ["serve"]) assert result.exit_code == 0 - #mock_setup_logging.assert_called_once_with(LogLevel.INFO, LogFormat.JSON) - #mock_logging.assert_called_with("codegate") + # mock_setup_logging.assert_called_once_with(LogLevel.INFO, LogFormat.JSON) + # mock_logging.assert_called_with("codegate") # validate only a subset of the expected extra arguments - #expected_extra = { + # expected_extra = { # "host": "localhost", # "port": 8989, # "log_level": "INFO", @@ -155,16 +151,16 @@ def test_serve_default_options( # "prompts_loaded": 7, # "provider_urls": DEFAULT_PROVIDER_URLS, # "certs_dir": "./certs", # Default certificate directory - #} + # } # Retrieve the actual call arguments - #calls = [call[1]["extra"] for call in logger_instance.info.call_args_list] + # calls = [call[1]["extra"] for call in logger_instance.info.call_args_list] # Check if one of the calls matches the expected subset - #assert any( + # assert any( # all(expected_extra[k] == actual_extra.get(k) for k in expected_extra) # for actual_extra in calls - #) + # ) mock_run.assert_called_once() @@ -201,13 +197,13 @@ def test_serve_custom_options( ) assert result.exit_code == 0 - #mock_setup_logging.assert_called_once_with(LogLevel.DEBUG, LogFormat.TEXT) - #mock_logging.assert_called_with("codegate") + # mock_setup_logging.assert_called_once_with(LogLevel.DEBUG, LogFormat.TEXT) + # mock_logging.assert_called_with("codegate") # Retrieve the actual call arguments - #calls = [call[1]["extra"] for call in logger_instance.info.call_args_list] + # calls = [call[1]["extra"] for call in logger_instance.info.call_args_list] - #expected_extra = { + # expected_extra = { # "host": "localhost", # "port": 8989, # "log_level": "DEBUG", @@ -215,13 +211,13 @@ def test_serve_custom_options( # "prompts_loaded": 7, # Default prompts are loaded # "provider_urls": DEFAULT_PROVIDER_URLS, # "certs_dir": "./custom-certs", - #} + # } # Check if one of the calls matches the expected subset - #assert any( + # assert any( # all(expected_extra[k] == actual_extra.get(k) for k in expected_extra) # for actual_extra in calls - #) + # ) mock_run.assert_called_once() @@ -249,13 +245,13 @@ def test_serve_with_config_file( result = cli_runner.invoke(cli, ["serve", "--config", str(temp_config_file)]) assert result.exit_code == 0 - #mock_setup_logging.assert_called_once_with(LogLevel.DEBUG, LogFormat.JSON) - #mock_logging.assert_called_with("codegate") + # mock_setup_logging.assert_called_once_with(LogLevel.DEBUG, LogFormat.JSON) + # mock_logging.assert_called_with("codegate") # Retrieve the actual call arguments - #calls = [call[1]["extra"] for call in logger_instance.info.call_args_list] + # calls = [call[1]["extra"] for call in logger_instance.info.call_args_list] - #expected_extra = { + # expected_extra = { # "host": "localhost", # "port": 8989, # "log_level": "DEBUG", @@ -263,13 +259,13 @@ def test_serve_with_config_file( # "prompts_loaded": 7, # Default prompts are loaded # "provider_urls": DEFAULT_PROVIDER_URLS, # "certs_dir": "./test-certs", # From config file - #} + # } # Check if one of the calls matches the expected subset - #assert any( + # assert any( # all(expected_extra[k] == actual_extra.get(k) for k in expected_extra) # for actual_extra in calls - #) + # ) mock_run.assert_called_once() @@ -319,13 +315,13 @@ def test_serve_priority_resolution( ) assert result.exit_code == 0 - #mock_setup_logging.assert_called_once_with(LogLevel.ERROR, LogFormat.TEXT) - #mock_logging.assert_called_with("codegate") + # mock_setup_logging.assert_called_once_with(LogLevel.ERROR, LogFormat.TEXT) + # mock_logging.assert_called_with("codegate") # Retrieve the actual call arguments - #calls = [call[1]["extra"] for call in logger_instance.info.call_args_list] + # calls = [call[1]["extra"] for call in logger_instance.info.call_args_list] - #expected_extra = { + # expected_extra = { # "host": "example.com", # "port": 8080, # "log_level": "ERROR", @@ -333,13 +329,13 @@ def test_serve_priority_resolution( # "prompts_loaded": 7, # Default prompts are loaded # "provider_urls": DEFAULT_PROVIDER_URLS, # "certs_dir": "./cli-certs", # CLI args override config file - #} + # } # Check if one of the calls matches the expected subset - #assert any( + # assert any( # all(expected_extra[k] == actual_extra.get(k) for k in expected_extra) # for actual_extra in calls - #) + # ) mock_run.assert_called_once() @@ -368,13 +364,13 @@ def test_serve_certificate_options( ) assert result.exit_code == 0 - #mock_setup_logging.assert_called_once_with(LogLevel.INFO, LogFormat.JSON) - #mock_logging.assert_called_with("codegate") + # mock_setup_logging.assert_called_once_with(LogLevel.INFO, LogFormat.JSON) + # mock_logging.assert_called_with("codegate") # Retrieve the actual call arguments - #calls = [call[1]["extra"] for call in logger_instance.info.call_args_list] + # calls = [call[1]["extra"] for call in logger_instance.info.call_args_list] - #expected_extra = { + # expected_extra = { # "host": "localhost", # "port": 8989, # "log_level": "INFO", @@ -382,13 +378,13 @@ def test_serve_certificate_options( # "prompts_loaded": 6, # "provider_urls": DEFAULT_PROVIDER_URLS, # "certs_dir": "./custom-certs", - #} + # } # Check if one of the calls matches the expected subset - #assert any( + # assert any( # all(expected_extra[k] == actual_extra.get(k) for k in expected_extra) # for actual_extra in calls - #) + # ) mock_run.assert_called_once() diff --git a/tests/test_config.py b/tests/test_config.py index 290a96c7..8261c92b 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -17,7 +17,7 @@ def test_default_config(default_config: Config) -> None: assert default_config.log_format == LogFormat.JSON assert default_config.provider_urls == DEFAULT_PROVIDER_URLS # Test default certificate configuration - assert default_config.certs_dir == "./certs" + assert default_config.certs_dir == "./codegate_volume/certs" assert default_config.ca_cert == "ca.crt" assert default_config.ca_key == "ca.key" assert default_config.server_cert == "server.crt"