Repository navigation
Expand file tree
/
Copy pathkbi_setup_script.sh
More file actions
executable file
·74 lines (59 loc) · 1.96 KB
/
Copy pathkbi_setup_script.sh
File metadata and controls
executable file
·74 lines (59 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
# KBI Labs Complete Setup Script
# Sets up and runs the complete enrichment pipeline
echo "========================================"
echo "KBI LABS COMPLETE ENRICHMENT SETUP"
echo "========================================"
# Check if running on Ubuntu/Debian
if ! command -v apt &> /dev/null; then
echo "This script is designed for Ubuntu/Debian systems"
exit 1
fi
# Function to check and set API keys
check_api_keys() {
echo -e "\n📋 Checking API Keys..."
MISSING_KEYS=()
# Check each required API key
if [ -z "$SAM_GOV_API_KEY" ]; then
MISSING_KEYS+=("SAM_GOV_API_KEY")
fi
if [ -z "$CENSUS_API_KEY" ]; then
MISSING_KEYS+=("CENSUS_API_KEY")
fi
if [ -z "$USPTO_API_KEY" ]; then
MISSING_KEYS+=("USPTO_API_KEY")
fi
if [ -z "$NSF_API_KEY" ]; then
MISSING_KEYS+=("NSF_API_KEY")
fi
if [ -z "$FRED_API_KEY" ]; then
MISSING_KEYS+=("FRED_API_KEY")
fi
# If keys are missing, prompt for them
if [ ${#MISSING_KEYS[@]} -gt 0 ]; then
echo "The following API keys are missing:"
for key in "${MISSING_KEYS[@]}"; do
echo " - $key"
done
echo -e "\nWould you like to enter them now? (y/n)"
read -r response
if [[ "$response" == "y" ]]; then
for key in "${MISSING_KEYS[@]}"; do
echo -n "Enter $key: "
read -r value
export "$key=$value"
done
# Save to .env file
echo -e "\nSaving API keys to .env file..."
cat > .env << EOF
# KBI Labs API Keys
SAM_GOV_API_KEY=$SAM_GOV_API_KEY
CENSUS_API_KEY=$CENSUS_API_KEY
USPTO_API_KEY=$USPTO_API_KEY
NSF_API_KEY=$NSF_API_KEY
FRED_API_KEY=$FRED_API_KEY
# Database Configuration
DATABASE_URL=postgresql://ubuntu:kbi_labs_2024@localhost:5432/kbi_enriched_full
# Processing Configuration
MAX_CONCURRENT_REQUESTS=50
BATCH_SIZE=100