Repository navigation
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·87 lines (73 loc) · 2.65 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·87 lines (73 loc) · 2.65 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
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
# Payliance Azure Function Setup Script
set -e
echo "🔧 Setting up Payliance Azure Function Development Environment"
echo "============================================================"
# Check Python version
echo "🐍 Checking Python version..."
python_version=$(python3 --version 2>&1 | cut -d' ' -f2)
echo " Python version: $python_version"
# Check if required Python version
required_version="3.8"
if python3 -c "import sys; exit(0 if sys.version_info >= (3, 8) else 1)"; then
echo "✅ Python version is compatible"
else
echo "❌ Python 3.8 or higher is required"
exit 1
fi
# Create virtual environment if it doesn't exist
if [ ! -d "venv" ]; then
echo "📦 Creating virtual environment..."
python3 -m venv venv
fi
# Activate virtual environment
echo "🔌 Activating virtual environment..."
source venv/bin/activate
# Upgrade pip
echo "⬆️ Upgrading pip..."
pip3 install --upgrade pip
# Install requirements
echo "📥 Installing Python packages..."
pip3 install -r requirements.txt
# Check if Azure Functions Core Tools is installed
echo "🔍 Checking Azure Functions Core Tools..."
if command -v func &> /dev/null; then
func_version=$(func --version)
echo "✅ Azure Functions Core Tools installed: $func_version"
else
echo "⚠️ Azure Functions Core Tools not found"
echo "💡 Install with: npm install -g azure-functions-core-tools@4 --unsafe-perm true"
echo " Or download from: https://github.com/Azure/azure-functions-core-tools"
fi
# Check if Azure CLI is installed
echo "🔍 Checking Azure CLI..."
if command -v az &> /dev/null; then
az_version=$(az --version | head -n1)
echo "✅ Azure CLI installed: $az_version"
else
echo "⚠️ Azure CLI not found"
echo "💡 Install from: https://docs.microsoft.com/en-us/cli/azure/install-azure-cli"
fi
# Create .env file from template if it doesn't exist
if [ ! -f ".env" ]; then
echo "📝 Creating .env file from template..."
cp .env.template .env
echo "⚠️ Please update .env file with your actual Payliance credentials"
fi
echo ""
echo "✅ Setup completed successfully!"
echo ""
echo "📋 Next steps:"
echo "1. Update .env file with your Payliance credentials"
echo "2. Update local.settings.json with your configuration"
echo "3. Run the function locally: func start"
echo "4. Test with: python test_function.py"
echo ""
echo "🔗 Useful commands:"
echo " - Start function locally: func start"
echo " - Run tests: python test_function.py"
echo " - Deploy to Azure: ./deploy.sh"
echo ""
# Show current directory structure
echo "📁 Project structure:"
find . -maxdepth 2 -type f -not -path "./venv/*" -not -path "./.git/*" | sort