-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
Β·56 lines (46 loc) Β· 1.69 KB
/
setup.sh
File metadata and controls
executable file
Β·56 lines (46 loc) Β· 1.69 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
#!/bin/bash
echo "π Setting up Comfy Workflows API..."
# Install dependencies
echo "π¦ Installing dependencies..."
npm install
# Check if .env exists, if not prompt for API key
if [ ! -f .env ]; then
echo ""
echo "π Setting up environment for local server..."
read -p "Enter your ADMIN_API_KEY (or press Enter for 'super-secret'): " api_key
api_key=${api_key:-super-secret}
echo "ADMIN_API_KEY=$api_key" > .env
echo "PORT=8787" >> .env
echo "CORS_ALLOW_ORIGIN=*" >> .env
echo "DATA_FILE=./workflows.json" >> .env
echo "β
Created .env file"
fi
# Check if .dev.vars exists for wrangler dev
if [ ! -f .dev.vars ]; then
echo ""
echo "π Setting up .dev.vars for Cloudflare Worker local dev..."
read -p "Enter your ADMIN_API_KEY for wrangler dev (or press Enter for 'super-secret'): " wrangler_key
wrangler_key=${wrangler_key:-super-secret}
echo "ADMIN_API_KEY=$wrangler_key" > .dev.vars
echo "CORS_ALLOW_ORIGIN=*" >> .dev.vars
echo "β
Created .dev.vars file"
fi
echo ""
echo "β
Setup complete!"
echo ""
echo "π Available commands:"
echo " npm start - Run local server (Express, Node 18+)"
echo " npm run dev - Run Cloudflare Worker locally (Node 20+)"
echo " npm run deploy - Deploy to Cloudflare Workers"
echo ""
echo "π§ͺ To test the API:"
echo " 1. Start the server: npm start (or: nvm use 20 && npm run dev)"
echo " 2. Open test.html in your browser"
echo ""
echo "π³ Docker commands:"
echo " docker-compose up -d - Start with Docker Compose"
echo " docker-compose down - Stop Docker containers"
echo ""
echo "π‘ Note: Cloudflare Worker commands require Node v20+"
echo " Use 'nvm use 20' if you have nvm installed"
echo ""