diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..5048358 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2020 Dawid WysokiƄski + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..a3b725f --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +# TWHelp API + +Graphql API with TribalWars servers data. + +## Development + +**Required env variables to run this API** (you can set them directly in your system or create .env.development file): + +``` +DB_USER=your_pgdb_user +DB_NAME=your_pgdb_name +DB_PORT=your_pgdb_port +DB_HOST=your_pgdb_host +DB_PASSWORD=your_pgdb_password +REDIS_HOST=your_redis_host +REDIS_PORT=your_redis_port +LIMIT_WHITELIST=127.0.0.1,::1 +LOG_DB_QUERIES=[true|false] +``` + +### Prerequisites + +1. Golang +2. PostgreSQL database +3. Configured [cron](https://github.com/tribalwarshelp/cron) + +### Installing + +1. Clone this repo. +2. Navigate to the directory where you have cloned this repo. +3. Set the required env variables directly on your system or create .env.development file. +4. go run main.go diff --git a/go.mod b/go.mod index b3aa674..59f365c 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/segmentio/encoding v0.1.14 // indirect github.com/tribalwarshelp/map-generator v0.0.0-20200801113621-fb8892ceb243 - github.com/tribalwarshelp/shared v0.0.0-20200809125423-2bc2e8dfde95 + github.com/tribalwarshelp/shared v0.0.0-20200824102353-ef15dea9c1a3 github.com/vektah/gqlparser/v2 v2.0.1 golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208 golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae // indirect diff --git a/go.sum b/go.sum index f9a95fd..feab8c2 100644 --- a/go.sum +++ b/go.sum @@ -191,10 +191,10 @@ github.com/tribalwarshelp/map-generator v0.0.0-20200801113621-fb8892ceb243 h1:ke github.com/tribalwarshelp/map-generator v0.0.0-20200801113621-fb8892ceb243/go.mod h1:hVGbToOex7CV5+DAV6QfVMx1XDgp30DOoyOapbr+Vj4= github.com/tribalwarshelp/shared v0.0.0-20200622084436-3a768c8bf574 h1:y2EoH6zRK9Uc0AeswnJRYUUIQYcSLZB5VDFuxPCKxNM= github.com/tribalwarshelp/shared v0.0.0-20200622084436-3a768c8bf574/go.mod h1:tf+2yTHasV6jAF3V2deZ9slNoCyBzC0fMdTjI7clf6Y= -github.com/tribalwarshelp/shared v0.0.0-20200728103702-87e7e5f1b8fd h1:AHGZw26jj2uPgFRPLRouFjJJV97Y/p9zLgSW79ZdcVk= -github.com/tribalwarshelp/shared v0.0.0-20200728103702-87e7e5f1b8fd/go.mod h1:SSWchTkQdgeIDr0C68C7zopEIcBLCUa8Ic2CHenUaac= github.com/tribalwarshelp/shared v0.0.0-20200809125423-2bc2e8dfde95 h1:mO3ZR+o5UlYN8uGX4L32H5HNpB0uHpLdZ3YiDA6ciW4= github.com/tribalwarshelp/shared v0.0.0-20200809125423-2bc2e8dfde95/go.mod h1:SSWchTkQdgeIDr0C68C7zopEIcBLCUa8Ic2CHenUaac= +github.com/tribalwarshelp/shared v0.0.0-20200824102353-ef15dea9c1a3 h1:KNH15DdQLxZAahSfX+4U4KUhsqRWj7uxjuOkxxhrQZk= +github.com/tribalwarshelp/shared v0.0.0-20200824102353-ef15dea9c1a3/go.mod h1:SSWchTkQdgeIDr0C68C7zopEIcBLCUa8Ic2CHenUaac= github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= diff --git a/readme.md b/readme.md deleted file mode 100644 index 2f2b70f..0000000 --- a/readme.md +++ /dev/null @@ -1,13 +0,0 @@ -# API - -Required ENV Variables: - -- DB_USER=postgres -- DB_NAME=tw -- DB_PORT=5432 -- DB_HOST=localhost -- DB_PASSWORD=asdf -- REDIS_HOST=localhost -- REDIS_PORT=6379 -- LIMIT_WHITELIST=127.0.0.1,::1 -- LOG_DB_QUERIES=false