Skip to content

Commit

Permalink
Moved OMD path to pears.ini
Browse files Browse the repository at this point in the history
  • Loading branch information
minimalparts committed Feb 14, 2024
1 parent f9f1215 commit 8bf3fcc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def configure_logging():
app.config.from_object('config')
load_dotenv('app/static/conf/pears.ini')
AUTH_TOKEN = os.getenv('AUTH_TOKEN')
OMD_PATH = os.getenv('OMD_PATH')

# Define the database object which is imported
# by modules and controllers
Expand Down Expand Up @@ -130,7 +131,7 @@ def is_accessible(self):
if LOCAL_RUN:
url = 'http://localhost:9191/api' #Local test
else:
url = ' https://demo.onmydisk.net/signin/'
url = join(OMD_PATH, 'signin/')
data = {'action': 'getUserInfo', 'session_id': access_token}
resp = requests.post(url, json=data, headers={'accept':'application/json', 'Authorization': 'token:'+access_token})
if resp.status_code == requests.codes.ok:
Expand Down
8 changes: 4 additions & 4 deletions app/auth/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import requests
from os.path import dirname, join, realpath, isfile
from flask import jsonify, Response
from app import LOCAL_RUN, AUTH_TOKEN
from app import LOCAL_RUN, AUTH_TOKEN, OMD_PATH

# Define the blueprint:
auth = Blueprint('auth', __name__, url_prefix='/auth')
Expand All @@ -47,7 +47,7 @@ def login():
if LOCAL_RUN:
url = 'http://localhost:9191/api' #Local test
else:
url = 'https://demo.onmydisk.net/signin/'
url = join(OMD_PATH, 'signin/')
data = {'action': 'signin', 'username': username, 'password': password}
user_info = requests.post(url, json=data)
if user_info == None:
Expand Down Expand Up @@ -82,7 +82,7 @@ def logout():
if LOCAL_RUN:
url = 'http://localhost:9191/api' #Local test
else:
url = 'https://demo.onmydisk.net/signout/'
url = join(OMD_PATH, 'signout/')
data = {'action': 'signout', 'session_id': access_token}
logout_confirmation = requests.post(url, json=data, headers={'accept':'application/json', 'Authorization': 'token:'+access_token})
if logout_confirmation.status_code == requests.codes.ok:
Expand Down Expand Up @@ -127,7 +127,7 @@ def decorated_function(*args, **kwargs):
if LOCAL_RUN:
url = 'http://localhost:9191/api' #Local test
else:
url = 'https://demo.onmydisk.net/signin/'
url = join(OMD_PATH, 'signin/')
data = {'action': 'getUserInfo', 'session_id': access_token}
resp = requests.post(url, json=data, headers={'accept':'application/json', 'Authorization': 'token:'+access_token})
if resp.status_code == requests.codes.ok and resp.json()['valid']:
Expand Down
8 changes: 4 additions & 4 deletions app/search/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from os.path import dirname, join, realpath, isfile
from flask import jsonify, Response, session
from app.utils import init_podsum
from app import LOCAL_RUN
from app import LOCAL_RUN, OMD_PATH

LOG = logging.getLogger(__name__)

Expand All @@ -42,7 +42,7 @@ def user(access_token):
if LOCAL_RUN:
url = 'http://localhost:9191/api' #Local test
else:
url = 'https://demo.onmydisk.net/'
url = OMD_PATH

results = []
if Urls.query.count() == 0:
Expand Down Expand Up @@ -82,7 +82,7 @@ def anonymous():
if LOCAL_RUN:
url = 'http://localhost:9090/static/testdocs/shared' #Local test
else:
url = 'https://demo.onmydisk.net/shared'
url = join(OMD_PATH, 'shared')
results, pods = score_pages.run(query, pears, url_filter=[url])
r = app.make_response(jsonify(results))
r.mimetype = "application/json"
Expand All @@ -103,7 +103,7 @@ def index():
if LOCAL_RUN:
url = 'http://localhost:9191/api' #Local test
else:
url = 'https://demo.onmydisk.net/'
url = OMD_PATH
print("CONNECTING TO:",url)
data = {'action': 'getUserInfo', 'session_id': access_token}
resp = requests.post(url, json=data, headers={'accept':'application/json', 'Authorization': 'token:'+access_token})
Expand Down

0 comments on commit 8bf3fcc

Please sign in to comment.