Skip to content
This repository has been archived by the owner on Sep 18, 2019. It is now read-only.

Commit

Permalink
Add application.cfg, init, model
Browse files Browse the repository at this point in the history
  • Loading branch information
grewn0uille committed Feb 8, 2018
1 parent 3cd4444 commit e6ea859
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
21 changes: 21 additions & 0 deletions sherlog/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import os

from flask import Flask
from urllib.parse import urlparse

from sqlalchemy import create_engine


app = Flask(__name__)
app.config.from_envvar('FLASK_CONFIG')

engine = create_engine(app.config['DB'])

@app.cli.command()
def drop_db():
filename = urlparse(app.config['DB']).path
if os.path.isfile(filename):
os.remove(filename)


from .sherlog import *
1 change: 1 addition & 0 deletions sherlog/application.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DB = 'sqlite:https:////tmp/sherlog.sqlite'
25 changes: 25 additions & 0 deletions sherlog/model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from sqlalchemy import Boolean, Column, DateTime, Integer, String
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()


class Log(Base):
__tablename__ = 'log'

id = Column(Integer, primary_key=True)

return_code = Column(Integer, nullable=False)
message = Column(String, nullable=False)
url = Column(String, nullable=True)
ok = Column(Boolean, nullable=False)
host = Column(String, nullable=True)
start = Column(DateTime, nullable=False)
stop = Column(DateTime, nullable=False)
status = Column(String, nullable=False)

stderr = Column(String, nullable=True)
stdout = Column(String, nullable=True)
command = Column(String, nullable=True)

server_name = Column(String, nullable=False)
Empty file added sherlog/sherlog.py
Empty file.

0 comments on commit e6ea859

Please sign in to comment.