API proxy for identifying Greenmobility vehicles requiring charging in proximity to available Spirii charging stations. Returns a static map image with vehicle and charger locations.
The system consists of an AWS Lambda function (Go) fronted by API Gateway. It interacts with:
- Greenmobility API: Fetches vehicle locations and battery levels.
- Spirii API: Fetches charging station availability.
- Geoapify Static Maps API: Generates the visualization.
Environment variables are managed via .env:
GREENMO_AWS_REGION: Target AWS region.GREENMO_OPEN_MAPS_API_TOKEN: Geoapify API key.GREENMO_DOMAIN_NAME: Publicly accessible domain name.GREENMO_CERTIFICATE_ARN: ARN of the Certificate from ACM
Optional Environment variables used for local testing:
GREENMO_API_URL: Deployed API Gateway endpoint.GREENMO_API_KEY: API Gateway x-api-key for authentication.
Use run.sh for local operations:
Runs the Go test suite with mock servers for external dependencies.
./run.sh testExecutes the function logic locally.
./run.sh runSends a test request to the deployed production endpoint.
./run.sh triggerDeployment is managed via AWS SAM. Ensure AWS credentials are configured in the environment.
The deploy.sh script automates the SAM build and deployment process:
./deploy.shThis script:
- Builds the Go binary using a containerized environment.
- Deploys the CloudFormation stack
greenmo-stalker-stack. - Overrides parameters for the Map API token and API Key using values from
.env.
