xenfra 0.2.7__tar.gz → 0.2.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: xenfra
3
- Version: 0.2.7
3
+ Version: 0.2.8
4
4
  Summary: A 'Zen Mode' infrastructure engine for Python developers.
5
5
  Author: xenfra-cloud
6
6
  Author-email: xenfra-cloud <xenfracloud@gmail.com>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "xenfra"
3
- version = "0.2.7"
3
+ version = "0.2.8"
4
4
  description = "A 'Zen Mode' infrastructure engine for Python developers."
5
5
  readme = "README.md"
6
6
  authors = [
@@ -51,4 +51,4 @@ xenfra = "xenfra.main:main"
51
51
 
52
52
  [build-system]
53
53
  requires = ["uv_build>=0.9.18,<0.10.0"]
54
- build-backend = "uv_build"
54
+ build-backend = "uv_build"
@@ -5,10 +5,8 @@ A modern, AI-powered CLI for deploying Python apps to DigitalOcean.
5
5
  """
6
6
 
7
7
  import os
8
- from pathlib import Path
9
8
 
10
9
  import click
11
- from dotenv import load_dotenv
12
10
  from rich.console import Console
13
11
 
14
12
  from .commands.auth import auth
@@ -19,14 +17,12 @@ from .commands.security_cmd import security
19
17
 
20
18
  console = Console()
21
19
 
22
- # Load .env file from project root (searches parent directories)
23
- # This allows CLI to use XENFRA_API_URL and other vars from .env
24
- load_dotenv(dotenv_path=Path.cwd() / ".env", override=False)
25
- load_dotenv(override=False) # Also check current directory and parents
20
+ # Production-ready: API URL is hardcoded as https://api.xenfra.tech
21
+ # No configuration needed - works out of the box after pip install
26
22
 
27
23
 
28
24
  @click.group()
29
- @click.version_option(version="0.2.3")
25
+ @click.version_option(version="0.2.5")
30
26
  def cli():
31
27
  """
32
28
  Xenfra CLI: Deploy Python apps to DigitalOcean with zero configuration.
@@ -44,22 +44,15 @@ class SecurityConfig:
44
44
 
45
45
  def __init__(self):
46
46
  """Initialize security configuration from environment."""
47
- # Environment detection - Solution 3
48
- self.environment = os.getenv("XENFRA_ENV", "development").lower()
49
-
50
- # Security settings (can be overridden by environment variables)
51
- self.enforce_https = os.getenv("XENFRA_ENFORCE_HTTPS", "false").lower() == "true"
52
- self.enforce_whitelist = os.getenv("XENFRA_ENFORCE_WHITELIST", "false").lower() == "true"
53
- self.enable_cert_pinning = (
54
- os.getenv("XENFRA_ENABLE_CERT_PINNING", "false").lower() == "true"
55
- )
56
- self.warn_on_http = os.getenv("XENFRA_WARN_ON_HTTP", "true").lower() == "true"
47
+ # PRODUCTION-ONLY: Default to production settings
48
+ # Environment variable only used for self-hosted instances
49
+ self.environment = "production"
57
50
 
58
- # Auto-enable strict security in production
59
- if self.environment == "production":
60
- self.enforce_https = True
61
- self.enforce_whitelist = True
62
- self.enable_cert_pinning = True
51
+ # Security settings - ALWAYS enforced for production safety
52
+ self.enforce_https = True # Always require HTTPS
53
+ self.enforce_whitelist = False # Allow self-hosted instances
54
+ self.enable_cert_pinning = False # Disabled (see future-enhancements.md #3)
55
+ self.warn_on_http = True # Always warn on HTTP
63
56
 
64
57
  def is_production(self) -> bool:
65
58
  """Check if running in production environment."""
@@ -243,25 +236,19 @@ def validate_and_get_api_url(url: str = None) -> str:
243
236
  Comprehensive API URL validation (combines all 4 solutions).
244
237
 
245
238
  Args:
246
- url: Optional URL override (defaults to XENFRA_API_URL env var)
239
+ url: Optional URL override (only for self-hosted instances)
247
240
 
248
241
  Returns:
249
- Validated API URL
242
+ Validated API URL (defaults to https://api.xenfra.tech)
250
243
 
251
244
  Raises:
252
245
  ValueError: If URL fails validation
253
246
  click.Abort: If user cancels security prompts
254
247
  """
255
- # Get URL from parameter or environment
248
+ # PRODUCTION DEFAULT: Use hardcoded production URL
249
+ # Only check environment variable for self-hosted overrides
256
250
  if url is None:
257
- url = os.getenv("XENFRA_API_URL")
258
-
259
- # Use production URL in production environment
260
- if url is None and security_config.is_production():
261
- url = PRODUCTION_API_URL
262
- # Use localhost in development
263
- elif url is None:
264
- url = "http://localhost:8000"
251
+ url = os.getenv("XENFRA_API_URL", PRODUCTION_API_URL)
265
252
 
266
253
  try:
267
254
  # Solution 1: Validate URL format
@@ -316,41 +303,34 @@ def display_security_info():
316
303
 
317
304
  # Environment variable documentation
318
305
  """
319
- Security can be configured via environment variables:
320
-
321
- XENFRA_ENV=production|staging|development
322
- - Controls default security settings
323
- - production: All security features enabled
324
- - development: Permissive mode (localhost allowed)
306
+ PRODUCTION-FIRST DESIGN:
307
+ The CLI defaults to production (api.xenfra.tech) with HTTPS enforcement.
308
+ No configuration needed for normal users.
325
309
 
326
- XENFRA_ENFORCE_HTTPS=true|false
327
- - Require HTTPS for all connections (except localhost)
328
- - Default: false (dev), true (production)
329
-
330
- XENFRA_ENFORCE_WHITELIST=true|false
331
- - Block connections to non-whitelisted domains
332
- - Default: false (dev), true (production)
310
+ Environment variables (for developers/self-hosted only):
333
311
 
334
- XENFRA_ENABLE_CERT_PINNING=true|false
335
- - Enable certificate pinning for production domains
336
- - Default: false (dev), true (production)
312
+ XENFRA_ENV=development
313
+ - Enables local development mode
314
+ - Allows HTTP, relaxes security
315
+ - Default: production (safe by default)
337
316
 
338
- XENFRA_WARN_ON_HTTP=true|false
339
- - Show warning when using HTTP (non-localhost)
340
- - Default: true
317
+ XENFRA_API_URL=https://your-instance.com
318
+ - Override API URL for self-hosted instances
319
+ - Default: https://api.xenfra.tech
341
320
 
342
- XENFRA_API_URL=https://api.example.com
343
- - Override default API URL
344
- - Subject to all security validations
321
+ XENFRA_ENFORCE_HTTPS=true|false
322
+ - Require HTTPS for all connections
323
+ - Default: true (production), false (development)
345
324
 
346
325
  Example usage:
347
326
 
348
- # Development (permissive):
349
- XENFRA_API_URL=http://localhost:8000 xenfra login
327
+ # Production users (zero config):
328
+ xenfra auth login
329
+ xenfra deploy
350
330
 
351
- # Self-hosted instance (disable whitelist):
352
- XENFRA_API_URL=https://xenfra.mycompany.com XENFRA_ENFORCE_WHITELIST=false xenfra login
331
+ # Local development:
332
+ XENFRA_ENV=development xenfra auth login
353
333
 
354
- # Production (strict):
355
- XENFRA_ENV=production XENFRA_API_URL=https://api.xenfra.tech xenfra login
334
+ # Self-hosted instance:
335
+ XENFRA_API_URL=https://xenfra.mycompany.com xenfra login
356
336
  """
File without changes
File without changes
File without changes