fix: update .gitignore to exclude tracked runtime files
Some checks failed
CLI Tests / test-cli (push) Failing after 3s
Security Scanning / security-scan (push) Successful in 22s

- Added cli/config/ to gitignore (CLI configuration files)
- Added dev/cache/logs/ to gitignore (development logs)
- Added dev/config/ to gitignore (development config)
- Added dev/test-nodes/*/data/ to gitignore (test node data)
- Removed tracked runtime files from git index
- Kept apps/coordinator-api/src/app/data/ (contains application code)
- Removed contracts/artifacts/**/*.dbg.json (debug artifacts)
- Removed dev/test-nodes/brother_node/data/*.db (database files)
- Removed dev/cache/logs/*.log (log files)
- Removed dev/config/* (development config files)
This commit is contained in:
aitbc
2026-04-23 12:36:41 +02:00
parent 522655ef92
commit af7a971404
69 changed files with 5 additions and 685 deletions

View File

@@ -1,114 +0,0 @@
"""Configuration management for AITBC CLI"""
import os
import yaml
from pathlib import Path
from typing import Optional
from dataclasses import dataclass, field
from dotenv import load_dotenv
@dataclass
class Config:
"""Configuration object for AITBC CLI"""
coordinator_url: str = "http://127.0.0.1:8000"
api_key: Optional[str] = None
role: Optional[str] = None # admin, client, miner, etc.
config_dir: Path = field(default_factory=lambda: Path.home() / ".aitbc")
config_file: Optional[str] = None
blockchain_rpc_url: str = "http://127.0.0.1:8006"
wallet_url: str = "http://127.0.0.1:8002"
def _validate_localhost_urls(self):
"""Validate that all service URLs point to localhost"""
localhost_prefixes = ["http://localhost:", "http://127.0.0.1:", "https://localhost:", "https://127.0.0.1:"]
urls_to_check = [
("coordinator_url", self.coordinator_url),
("blockchain_rpc_url", self.blockchain_rpc_url),
("wallet_url", self.wallet_url)
]
for url_name, url in urls_to_check:
if not any(url.startswith(prefix) for prefix in localhost_prefixes):
# Force to localhost if not already
if url_name == "coordinator_url":
self.coordinator_url = "http://localhost:8000"
elif url_name == "blockchain_rpc_url":
self.blockchain_rpc_url = "http://localhost:8006"
elif url_name == "wallet_url":
self.wallet_url = "http://localhost:8002"
def __post_init__(self):
"""Initialize configuration"""
# Load environment variables
load_dotenv()
# Set default config file based on role if not specified
if not self.config_file:
if self.role:
self.config_file = str(self.config_dir / f"{self.role}-config.yaml")
else:
self.config_file = str(self.config_dir / "config.yaml")
# Load config from file if it exists
self.load_from_file()
# Override with environment variables
if os.getenv("AITBC_URL"):
self.coordinator_url = os.getenv("AITBC_URL")
if os.getenv("AITBC_API_KEY"):
self.api_key = os.getenv("AITBC_API_KEY")
if os.getenv("AITBC_ROLE"):
self.role = os.getenv("AITBC_ROLE")
if os.getenv("AITBC_BLOCKCHAIN_RPC_URL"):
self.blockchain_rpc_url = os.getenv("AITBC_BLOCKCHAIN_RPC_URL")
if os.getenv("AITBC_WALLET_URL"):
self.wallet_url = os.getenv("AITBC_WALLET_URL")
# Validate and enforce localhost URLs
self._validate_localhost_urls()
def load_from_file(self):
"""Load configuration from YAML file"""
if self.config_file and Path(self.config_file).exists():
try:
with open(self.config_file, 'r') as f:
data = yaml.safe_load(f) or {}
self.coordinator_url = data.get('coordinator_url', self.coordinator_url)
self.api_key = data.get('api_key', self.api_key)
self.role = data.get('role', self.role)
self.blockchain_rpc_url = data.get('blockchain_rpc_url', self.blockchain_rpc_url)
self.wallet_url = data.get('wallet_url', self.wallet_url)
except Exception as e:
print(f"Warning: Could not load config file: {e}")
# Validate and enforce localhost URLs after file loading
self._validate_localhost_urls()
def save_to_file(self):
"""Save configuration to YAML file"""
if not self.config_file:
return
# Ensure config directory exists
Path(self.config_file).parent.mkdir(parents=True, exist_ok=True)
data = {
'coordinator_url': self.coordinator_url,
'api_key': self.api_key,
'blockchain_rpc_url': self.blockchain_rpc_url,
'wallet_url': self.wallet_url
}
if self.role:
data['role'] = self.role
with open(self.config_file, 'w') as f:
yaml.dump(data, f, default_flow_style=False)
def get_config(config_file: Optional[str] = None, role: Optional[str] = None) -> Config:
"""Get configuration instance with optional role"""
return Config(config_file=config_file, role=role)

View File

@@ -1,29 +0,0 @@
description: Genesis configuration for AITBC Development Network
genesis:
accounts:
- address: "aitbc1genesis"
balance: "1000000000000000000000000"
type: "regular"
- address: "aitbc1faucet"
balance: "100000000000000000000000"
type: "faucet"
chain_type: main
consensus:
algorithm: poa
authorities:
- "ait1devproposer000000000000000000000000000000"
block_time: 5
max_validators: 100
contracts: []
description: Development network for AITBC multi-chain testing
name: AITBC Development Network
parameters:
block_reward: "2000000000000000000"
max_block_size: 1048576
max_gas_per_block: 10000000
min_gas_price: 1000000000
privacy:
access_control: open
require_invitation: false
visibility: public
purpose: development

View File

@@ -1,22 +0,0 @@
description: Genesis template for multi-chain-dev
genesis:
accounts: []
chain_type: topic
consensus:
algorithm: pos
authorities: []
block_time: 5
max_validators: 100
contracts: []
description: A multi-chain-dev chain for AITBC
name: Multi-Chain-Dev Chain
parameters:
block_reward: '2000000000000000000'
max_block_size: 1048576
max_gas_per_block: 10000000
min_gas_price: 1000000000
privacy:
access_control: open
require_invitation: false
visibility: public
purpose: multi-chain-dev

View File

@@ -1,31 +0,0 @@
chain:
type: "topic"
purpose: "healthcare"
name: "Healthcare AI Chain"
description: "A specialized chain for healthcare AI applications"
consensus:
algorithm: "pos"
block_time: 5
max_validators: 21
min_stake: 1000000000000000000 # 1 ETH
authorities: []
privacy:
visibility: "public"
access_control: "open"
require_invitation: false
encryption_enabled: false
parameters:
max_block_size: 1048576 # 1MB
max_gas_per_block: 10000000
min_gas_price: 20000000000 # 20 gwei
block_reward: "5000000000000000000" # 5 ETH
difficulty: 1000000
limits:
max_participants: 1000
max_contracts: 100
max_transactions_per_block: 500
max_storage_size: 1073741824 # 1GB

View File

@@ -1,26 +0,0 @@
# Multi-chain configuration for AITBC CLI
nodes:
default-node:
id: default-node
endpoint: http://localhost:8545
timeout: 30
retry_count: 3
max_connections: 10
aitbc-main:
id: aitbc-main
endpoint: http://localhost:8546
timeout: 30
retry_count: 3
max_connections: 10
chains:
default_gas_limit: 10000000
default_gas_price: 20000000000
max_block_size: 1048576
backup_path: ./backups
max_concurrent_chains: 100
logging_level: INFO
enable_caching: true
cache_ttl: 300