Structure copied from chat-server

This commit is contained in:
2021-03-06 14:49:02 +11:00
parent 6d3f068c8f
commit 725842f672
10 changed files with 148 additions and 1 deletions
+8
View File
@@ -0,0 +1,8 @@
WEB_PORT=3200
DB_HOSTNAME=database
DB_DATABASE=auth
DB_USERNAME=auth
DB_PASSWORD=venusaur
DB_TIMEZONE=Australia/Sydney
+36
View File
@@ -0,0 +1,36 @@
name: Publish Docker image
on:
release:
types: [ published ]
jobs:
push_to_registry:
name: Push Docker Image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check Out The Repo
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Get Smart Tag
id: prepare
uses: Surgo/docker-smart-tag-action@v1
with:
docker_image: krgamestudios/auth-server
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push to Docker Hub
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ steps.prepare.outputs.tag }}
platforms: amd64,arm
+3
View File
@@ -102,3 +102,6 @@ dist
# TernJS port file # TernJS port file
.tern-port .tern-port
# Docker generated files and folders
data/
+11
View File
@@ -0,0 +1,11 @@
Copyright (c) 2021 Kayne Ruse, KR Game Studios
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
+4 -1
View File
@@ -1,2 +1,5 @@
# auth-server # auth-server
An API centric auth server.
An API centric auth server. Uses Sequelize and mariaDB by default.
+32
View File
@@ -0,0 +1,32 @@
{
"name": "auth-server",
"version": "1.0.0",
"description": "An API centric auth server. Uses Sequelize and mariaDB by default.",
"main": "server/server.js",
"scripts": {
"start": "node server/server.js",
"dev": "npm run watch:server",
"watch:server": "nodemon . --ext js,jsx,json --ignore 'node_modules/*'"
},
"repository": {
"type": "git",
"url": "git+https://github.com/krgamestudios/auth-server.git"
},
"author": "Kayne Ruse",
"license": "ISC",
"bugs": {
"url": "https://github.com/krgamestudios/auth-server/issues"
},
"homepage": "https://github.com/krgamestudios/auth-server#readme",
"dependencies": {
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"mariadb": "^2.5.2",
"sequelize": "^6.5.0"
},
"devDependencies": {
"nodemon": "^2.0.7"
}
}
+10
View File
@@ -0,0 +1,10 @@
const express = require('express');
const router = express.Router();
//the routes
//TODO: import the routes here
//basic route management
//TODO: define the routes here
module.exports = router;
+12
View File
@@ -0,0 +1,12 @@
const Sequelize = require('sequelize');
const sequelize = new Sequelize(process.env.DB_DATABASE, process.env.DB_USERNAME, process.env.DB_PASSWORD, {
host: process.env.DB_HOSTNAME,
dialect: 'mariadb',
timezone: process.env.DB_TIMEZONE,
logging: false
});
sequelize.sync();
module.exports = sequelize;
+3
View File
@@ -0,0 +1,3 @@
module.exports = {
//TODO: models
};
+29
View File
@@ -0,0 +1,29 @@
//environment variables
require('dotenv').config();
//create the server
const express = require('express');
const app = express();
const server = require('http').Server(app);
const bodyParser = require('body-parser');
const cors = require('cors');
//config
app.use(bodyParser.json());
app.use(cors());
//database connection
const database = require('./database');
//access the news
app.use('/auth', require('./auth'));
//error on access
app.get('*', (req, res) => {
res.redirect('https://github.com/krgamestudios/auth-server');
});
//startup
server.listen(process.env.WEB_PORT || 3200, (err) => {
console.log(`listening to localhost:${process.env.WEB_PORT || 3200}`);
});