Skip to content

Commit

Permalink
README updated - documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
makuga01 committed Sep 17, 2019
1 parent 7f95bc5 commit 76f7a91
Show file tree
Hide file tree
Showing 7 changed files with 390 additions and 19 deletions.
Binary file modified BE/__pycache__/app.cpython-36.pyc
Binary file not shown.
Binary file modified BE/__pycache__/dns_resources.cpython-36.pyc
Binary file not shown.
10 changes: 8 additions & 2 deletions BE/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
api = Api(app)
cors = CORS(app, resources={r"/*": {"origins": "*"}})

"""
*** CONFIG ***
"""


DB_URL = 'postgresql+psycopg2://postgres:docker@localhost/dnsfookup'
DB_URL = 'postgresql+psycopg2://postgres:CHANGETHISTOO@localhost/dnsfookup'

app.config['SQLALCHEMY_DATABASE_URI'] = DB_URL
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False # silence the deprecation warning
Expand All @@ -30,6 +32,10 @@ def create_tables():
app.config['JWT_BLACKLIST_TOKEN_CHECKS'] = ['access']#, 'refresh]
app.config['JWT_ACCESS_TOKEN_EXPIRES'] = 60*60*6 # 6 hours

"""
*** CONFIG ***
"""

@jwt.token_in_blacklist_loader
def check_if_token_in_blacklist(decrypted_token):
jti = decrypted_token['jti']
Expand Down
29 changes: 19 additions & 10 deletions BE/dns.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
from datetime import datetime

"""
DNS SERVER CONFIG
*** CONFIG ***
"""

"""
UDP port DNS server will listen on, for testing purposes it's on 5053,
if you want to deploy the app on server change this to 53
"""
port = 5053
ip = "127.0.0.1"

Expand All @@ -19,6 +23,20 @@
"""
FAILURE_IP = '0.0.0.0'

"""
Redis configuration
REDIS_EXP - expiration of redis key
"""

redis_config = {"host": "127.0.0.1", "port": 6379, 'password': 'CHANGETHISPW'}
REDIS_EXP = 60 * 60 # 1 hour
redis = StrictRedis(socket_connect_timeout=3, **redis_config)


"""
*** CONFIG ***
"""

"""
SQLAlchemy models for easier access to database
"""
Expand Down Expand Up @@ -58,15 +76,6 @@ def save_to_db(self):
db.session.commit()


"""
Redis configuration
REDIS_EXP - expiration of redis key
"""

redis_config = {"host": "127.0.0.1", "port": 6379}
REDIS_EXP = 60 * 60 # seconds
redis = StrictRedis(socket_connect_timeout=3, **redis_config)

"""
Lambda functions used for easier manipulation with redis
"""
Expand Down
8 changes: 7 additions & 1 deletion BE/dns_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,22 @@
from redis import StrictRedis
from IPy import IP

"""
*** CONFIG ***
"""
DOMAIN = "gel0.space"

redis_config = {
'host': '127.0.0.1',
'port': 6379,
'password': 'CHANGETHISPW'
}
REDIS_EXP = 60*60 #seconds
redis = StrictRedis(socket_connect_timeout=3,**redis_config)


"""
*** CONFIG ***
"""

"""
For easier manipulation with redis
Expand Down
Loading

0 comments on commit 76f7a91

Please sign in to comment.