Skip to content

Commit

Permalink
v4.1 release (minor updates)
Browse files Browse the repository at this point in the history
  • Loading branch information
ozdemirozcelik committed Apr 5, 2023
1 parent c18807f commit efbaf39
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 90 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,15 @@ flask run
$env:FLASK_APP = "app.py"
$env:FLASK_ENV = "development"
$env:FLASK_DEBUG = "1"
(below is optional)
$env:DB_ADMIN_PASS = "YOUR_ADMIN_PASSWORD"
flask run
````
browse to "http://127.0.0.1:5000/" to see the dashboard.

you can also define an admin password during the initial creation of the database:
you can also define an admin password & passphrase during the initial creation of the database:
````
(below is optional)
$env:DB_ADMIN_PASS = "YOUR_ADMIN_PASSWORD"
$env:WEBHOOK_PASSPHRAASE = "YOUR_PASSPHRASE"
flask run
````

Expand Down Expand Up @@ -216,6 +215,12 @@ need a passphrase, by default it is set as 'webhook'; check config.ini:
WEBHOOK_PASSPHRASE : webhook
```
API looks for a WEBHOOK_PASSPHRASE environment variable first during signal creation/update:
```python
PASSPHRASE = os.environ.get("WEBHOOK_PASSPHRASE", configs.get("SECRET", "WEBHOOK_PASSPHRASE"))
```
### default admin and user
is created during database creation; check config.ini:
Expand Down
1 change: 0 additions & 1 deletion demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,4 +696,3 @@ def init_scheduler():
)

scheduler.start()
# sched.shutdown()
81 changes: 0 additions & 81 deletions email_notifications.py

This file was deleted.

3 changes: 2 additions & 1 deletion models/signals.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import re
from typing import Dict, List, Union # for type hinting
from db import db
Expand All @@ -14,7 +15,7 @@
SignalJSON = Dict[str, Union[str, float, int]] # custom type hint

# Passphrase is required to register webhooks (& to update account positions & PNL)
PASSPHRASE = configs.get("SECRET", "WEBHOOK_PASSPHRASE")
PASSPHRASE = os.environ.get("WEBHOOK_PASSPHRASE", configs.get("SECRET", "WEBHOOK_PASSPHRASE"))


class SignalModel(db.Model):
Expand Down
3 changes: 0 additions & 3 deletions notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
from demo import iftoday, timediff
from models.signals import SignalModel

# Passphrase is required to register webhooks (& to update account positions & PNL)
PASSPHRASE = configs.get("SECRET", "WEBHOOK_PASSPHRASE")

# configuration of email
app.config["MAIL_SERVER"] = configs.get("EMAIL", "MAIL_SERVER")
app.config["MAIL_PORT"] = int(configs.get("EMAIL", "MAIL_PORT"))
Expand Down
2 changes: 1 addition & 1 deletion tests/test_models_signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def test_passphrase_wrong(self):
phrase = "wrong"
self.assertTrue(SignalModel.passphrase_wrong(phrase))

default_phrase = configs.get("SECRET", "WEBHOOK_PASSPHRASE")
default_phrase = os.environ.get("WEBHOOK_PASSPHRASE", configs.get("SECRET", "WEBHOOK_PASSPHRASE"))
self.assertFalse(SignalModel.passphrase_wrong(default_phrase))

def test_insert_signal(self):
Expand Down

0 comments on commit efbaf39

Please sign in to comment.