Manage your Pizza Redirects as IaC (Infrastructure as Code) with this simple tool.
Create environment and install requirements (python >= 3.10)
python3 -m venv ./venv
source venv/bin/activate
pip install -r requirements.txtExport the following environment variables:
export PIZZA_TOKEN=...Pull latest state from redirects.pizza
redirects.py pullPush local state to redirects.pizza
redirects.py pushuse --force to skip confirmation
use --dryrun to skip actual push and local overwrite
All redirects will be stored in redirects.yaml.
Do not set the id field on new redirects. It will be pulled automatically from the API after creation.
- destination: https://www.example.ch/yourpath
id: 123456789
keep_query_string: false
redirect_type: permanent
sources:
- example.ch
- "*.example.ch"
- another.domain.ch/yourpath
tags:
- mytag
tracking: true
uri_forwarding: falseYou can use this tool in a Github Action to automatically update your redirects on redirects.pizza.
make sure to set the PIZZA_TOKEN environment variable in your Github Action Secrets.