forked from bitshares/tapin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
manage.py
executable file
·86 lines (67 loc) · 1.78 KB
/
manage.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/env python3
import click
default_config = {
"secret_key": "RANDOM-STRING",
"nobroadcast": True,
"mail_host": "SERVER:589",
"mail_user": "user",
"mail_pass": "password",
"mail_from": "[email protected]",
"admins": [
],
"minIPAge": 300,
"witness_url": "wss://node.bitshares.eu",
"registrar": "faucet",
"default_referrer": "xeroc",
"referrer_percent": 50,
"wif": "5KAniAqT1y4orQQ7KopKJ85QQXbVU92jbpV6KGGy5b396LpLYLM",
"balance_mailthreshold": 500,
"core_asset": "BTS"
}
@click.group()
def main():
pass
@main.command()
def install():
""" Setup default database """
from app import db
db.create_all()
@main.command()
def run():
""" Run the faucet in operational mode """
from app.web import app
app.run()
@main.command()
def debug():
""" Start debugging mode """
from app.web import app
app.run(debug=True)
@main.command()
def create(example="config"):
""" Create a default configuration file """
import yaml
config_file = "config.yml"
with open(config_file, "w") as fd:
dump = yaml.dump(
default_config,
default_flow_style = False)
fd.write( dump )
print("Config file created: %s" % config_file)
@main.command()
def gift(start=None, end=None):
""" Daemon that sends out gifts on new registrations """
import registration_gift
registration_gift.run(start, end)
@main.command()
def testmail():
""" Send a testmail """
from flask_mail import Message
from app import mail, config
msg = Message("Hello",
sender=config["mail_from"],
recipients=config["admins"])
mail.send(msg)
if __name__ == '__main__':
main()