add docker-compose for developers

create a apikey mechanism
pull/5/head
Mustafa Yontar 3 years ago
parent 960f9745ae
commit 55fe05c218
  1. 31
      docker-compose-dev.yaml
  2. 11
      docker-compose.yaml
  3. 10
      models/EmbededDocuments.py
  4. 2
      models/Union.py

@ -0,0 +1,31 @@
version: "3.3"
services:
mongo:
image: mongo
restart: always
environment:
MONGO_INITDB_ROOT_USERNAME: xcoder
MONGO_INITDB_ROOT_PASSWORD: 4dun4710
volumes:
- ./mongo_data_dir/:/data/db/
mongo-express:
image: mongo-express
restart: always
ports:
- 8081:8081
environment:
ME_CONFIG_MONGODB_ADMINUSERNAME: xcoder
ME_CONFIG_MONGODB_ADMINPASSWORD: 4dun4710
ME_CONFIG_OPTIONS_EDITORTHEME: ambiance
ME_CONFIG_BASICAUTH_USERNAME: xcoder
ME_CONFIG_BASICAUTH_PASSWORD: 4dun4710
web:
build: .
ports:
- "5000:5000"
environment:
ADUNATIO_PRIV_KEY: /code/privkey.pem
FLASK_DEBUG: 1
volumes:
- .:/code

@ -8,17 +8,6 @@ services:
MONGO_INITDB_ROOT_PASSWORD: 4dun4710
volumes:
- ./mongo_data_dir/:/data/db/
mongo-express:
image: mongo-express
restart: always
ports:
- 8081:8081
environment:
ME_CONFIG_MONGODB_ADMINUSERNAME: xcoder
ME_CONFIG_MONGODB_ADMINPASSWORD: 4dun4710
ME_CONFIG_OPTIONS_EDITORTHEME: ambiance
ME_CONFIG_BASICAUTH_USERNAME: xcoder
ME_CONFIG_BASICAUTH_PASSWORD: 4dun4710
web:
build: .

@ -1,6 +1,16 @@
from datetime import datetime
from mongoengine import *
class ApiKey(EmbeddedDocument):
secret = StringField()
key = StringField()
rights = ListField(StringField())
create_date = DateTimeField(default=datetime.utcnow)
creator = ReferenceField("User")
class Descriptions(EmbeddedDocument):
text = StringField()
user = ReferenceField("User")

@ -3,6 +3,7 @@ from werkzeug.security import generate_password_hash
from string import ascii_letters, digits
from random import choices
from models.EmbededDocuments import ApiKey
from restapi import Methods
@ -25,6 +26,7 @@ class Union(Document):
legal_registration_number = StringField()
headquarter = StringField()
email = StringField()
api_key = ListField(EmbeddedDocumentField(ApiKey))
def save(self, *args, **kwargs):
super(Union, self).save(*args, **kwargs)

Loading…
Cancel
Save