-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.py
30 lines (23 loc) · 787 Bytes
/
main.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
from tweet import TweetClient
import config as cfg
from db import LightningDB
from lndrpc import LndWrapper
from lightningrpc import LightningWrapper
from sys import argv
import os
import logging
def main():
logging.basicConfig(level=logging.INFO)
if len(argv) > 1 and argv[1]=='--clightning':
ln_path = cfg.LN_PATH or os.path.join(os.getenv('HOME'), '.lightning')
rpc_path = os.path.join(ln_path, 'lightning-rpc')
logging.debug(rpc_path)
ln = LightningWrapper(rpc_path,cfg)
else:
cert = open(os.path.expanduser(cfg.LND_CERT_PATH)).read()
ln = LndWrapper(cert, cfg)
db = LightningDB(cfg.DB_PATH)
tweet = TweetClient(cfg.twitter, db, cfg.twitter_owner, ln)
tweet.watch()
if __name__ == "__main__":
main()