fixed etherpad link

This commit is contained in:
root (fetsite6)
2020-10-19 20:44:40 +02:00
parent 460b9ba32a
commit c6fdd1c399
2 changed files with 18 additions and 5 deletions

View File

@@ -20,7 +20,7 @@ services:
etherpadsql: etherpadsql:
image: jbergstroem/mariadb-alpine image: jbergstroem/mariadb-alpine
environment: environment:
SKIP_INNODB: "yes" SKIP_INNODB: "no"
MYSQL_DATABASE: etherpaddb MYSQL_DATABASE: etherpaddb
MYSQL_USER: user MYSQL_USER: user
MYSQL_PASSWORD: hgu MYSQL_PASSWORD: hgu
@@ -37,14 +37,18 @@ services:
DB_NAME: etherpaddb DB_NAME: etherpaddb
DB_USER: user DB_USER: user
DB_PASS: hgu DB_PASS: hgu
DB_CHARSET: utf8
#ADMIN_PASSWORD: "AndiS"
#REQUIRE_AUTHENTICATION: "false"
TRUST_PROXY: "true" TRUST_PROXY: "true"
REQUIRE_SESSION: "true" REQUIRE_SESSION: "true"
#LOGLEVEL: "DEBUG"
depends_on: depends_on:
- etherpadsql - etherpadsql
ports: ports:
- "9001:9001" - "9001:9001"
volumes: volumes:
- ./APIKEY.txt:/opt/etherpad-lite/APIKEY.txt - ./etherpad/APIKEY.txt:/opt/etherpad-lite/APIKEY.txt
fet2020: fet2020:
image: fet2020django image: fet2020django
build: . build: .
@@ -62,7 +66,7 @@ services:
volumes: volumes:
- ./fet2020:/app - ./fet2020:/app
- ./assets:/app/assets - ./assets:/app/assets
- ./APIKEY.txt:/srv/etherpad/APIKEY.txt - ./etherpad:/app/etherpad
volumes: volumes:
ep-mysql-volume: ep-mysql-volume:
mysql-volume: mysql-volume:

View File

@@ -18,6 +18,8 @@ def get_ep_client():
try: try:
with open(os.path.abspath(settings.ETHERPAD_CLIENT["apikey"]), "r") as f: with open(os.path.abspath(settings.ETHERPAD_CLIENT["apikey"]), "r") as f:
apikey = f.read() apikey = f.read()
apikey = apikey.rstrip()
#logger.info(apikey)
epc = EtherpadLiteClient( epc = EtherpadLiteClient(
base_params={'apikey': apikey, }, base_params={'apikey': apikey, },
base_url=urllib.parse.urljoin(settings.ETHERPAD_CLIENT["url"], "api"), base_url=urllib.parse.urljoin(settings.ETHERPAD_CLIENT["url"], "api"),
@@ -26,7 +28,8 @@ def get_ep_client():
group = epc.createGroupIfNotExistsFor(groupMapper="fet") group = epc.createGroupIfNotExistsFor(groupMapper="fet")
except Exception as e: except Exception as e:
logger.info("Can't get connection to Etherpad Server. Error: {}".format(e)) logger.info("Can't get connection to Etherpad Server. Error: {}".format(e))
return None, None raise e
return None,None
return epc, group return epc, group
@@ -54,17 +57,23 @@ def __checkPadExists(padID=None):
def createPadifNotExists(padID): def createPadifNotExists(padID):
epc, group = get_ep_client() epc, group = get_ep_client()
if not epc: if not epc:
logger.info("meh, not EPC")
return None return None
# Pad doesn't exist # Pad doesn't exist
if not __checkPadExists(padID=padID): if not __checkPadExists(padID=padID):
try: try:
logger.info("trying creategrouppad")
epc.createGroupPad(groupID=group["groupID"], padName=padID, text="helloworld") epc.createGroupPad(groupID=group["groupID"], padName=padID, text="helloworld")
except EtherpadException as e: except EtherpadException as e:
# TODO: change it after Etherpad server is a better one than that because of http 500 # TODO: change it after Etherpad server is a better one than that because of http 500
logger.info("print e")
print(e) print(e)
return None
except Exception as e: except Exception as e:
logger.info("raise e")
raise e raise e
logger.info(padID)
return padID return padID