This repository has been archived by the owner on Sep 18, 2019. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3cd4444
commit e6ea859
Showing
4 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DB = 'sqlite:https:////tmp/sherlog.sqlite' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.