-
-
Notifications
You must be signed in to change notification settings - Fork 33
Development environment
Here is a quick guide for getting started with a development environment to contribute to the project. These are similar to the self-hosting instructions but oriented at developers who wish to contribute to the repository.
Start by cloning the repository into a directory of your choosing.
Once you have cloned the repository, copy .env.default
to .env
and choose a database username and password, and a developer token. The developer token is expected in the Authorization header of any requests that want to import or delete a savefile.
Then, open the solution in an IDE of your choice. Here are some suggestions:
- Visual Studio Community (free / Windows only). Should work out of the box.
- JetBrains Rider (paid / cross-platform). You may need to add a Docker Compose profile.
- Visual Studio Code (free / cross-platform). See here for setup.
Once the server is running, verify that all 3 containers start up properly and that they appear healthy. The server should now be live on localhost
-- try navigating to localhost/health
in your browser. If it says 'Healthy' this means that the app has successfully started and can connect to the database and Redis.
It is a good idea to set up a real Dragalia client to enable end-to-end testing. While it is possible to verify that your code works automated testing, the fact that we are working with a proprietary client means that seemingly valid response data can sometimes cause unforeseen issues when received by the client.
The docker-compose file will start the server on port 80, so you can use Dragalipatch (see README.md) with your PC's local IP address to play on your local server. You must input this as http://192.168.xxx.xxx
because without a http
prefix, Dragalipatch assumes HTTPS which is not enabled on the development setup.
Check that the postgres container has started properly and check its logs. If there are authentication failures, the credentials in .env may be wrong -- try deleting the pgdata
volume and restarting the compose to recreate the database from scratch.
This is possibly due to database credential issues -- did you set up .env as described at the start of this guide? Alternatively the database is persisted with docker-compose and if the credentials are changed after it has been created then these will now be invalid. To address this, delete the dragaliaapi-pgdata volume in Docker and the database will be recreated on next startup.
The codebase is linted by CSharpier which is checked when raising a pull request. CSharpier auto-formats code to a consistent style.
You can either set up this tool locally or you can use the pre-commit hook which has been set up by running
dotnet tool restore
dotnet husky install