https://github.com/pintman/code-or-die-py-docker
Docker container for the Python fork of code-or-die
https://github.com/pintman/code-or-die-py-docker
Last synced: 4 days ago
JSON representation
Docker container for the Python fork of code-or-die
- Host: GitHub
- URL: https://github.com/pintman/code-or-die-py-docker
- Owner: pintman
- Created: 2018-05-24T08:04:54.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-05-25T06:07:30.000Z (over 7 years ago)
- Last Synced: 2024-12-29T17:41:11.000Z (about 1 year ago)
- Language: Python
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Docker build for code or die - python version
This docker build relies on the
[fork of code-or-die by Julian Zucker](https://github.com/julian-zucker/code-or-die.git).
## Installation
Run ``docker-compose up -d`` to build and run the container
afterwards. Port 80 will be exposed on the docker host.
## Sample session
By default there a four teams named 'one', 'two', 'three' and 'four'. Get instructions
by requesting the root.
$ curl localhost/
The default API-Key for each team is the same as the team name and must be sent in
the header field 'api-key' for each request.
$ curl -H 'api-key: one' localhost/systems
[8]
$ curl -H 'api-key: one' localhost/systems/8
{"armies":{},"controller":"one","id":8,"names":[],"owner-information":{"tuning-parameters":[],"tuning_destinations":[]},"production":1,"routes":[{"destination":7,"distance":33},{"destination":9,"distance":20},{"destination":26,"distance":22},{"destination":98,"distance":10}]}
Player one controls one system with the number 8. Now let's change the default
api key.
$ curl -H 'api-key: one' -X POST -d '{"new-api-key":"123456"}' localhost/set-api-key
true
$ curl -H 'api-key: one' localhost/systems
null
$ curl -H 'api-key: 123456' localhost/systems
[8]