From a4dee262bef97845524c815fc6d02e7153527a1d Mon Sep 17 00:00:00 2001 From: Jonathan Baecker Date: Wed, 29 Jan 2020 17:39:57 +0100 Subject: [PATCH] functional auth --- ffplayout/api/views.py | 20 ++++++++++++++++---- ffplayout/db.sqlite3 | Bin 131072 -> 131072 bytes ffplayout/ffplayout/settings.py | 30 +++++++++++++++++++++++++++++- ffplayout/ffplayout/urls.py | 9 +++++++-- requirements-base.txt | 4 ++++ requirements.txt | 2 +- 6 files changed, 57 insertions(+), 8 deletions(-) create mode 100644 requirements-base.txt diff --git a/ffplayout/api/views.py b/ffplayout/api/views.py index 1915fe3a..a229005a 100644 --- a/ffplayout/api/views.py +++ b/ffplayout/api/views.py @@ -1,4 +1,6 @@ -# from django.shortcuts import render +import os + +from django.conf import settings from rest_framework.views import APIView from rest_framework.response import Response @@ -6,11 +8,21 @@ from .utils import IniParser class Config(APIView): + """ + read and write config from ffplayout engine + for reading, endpoint is: http://127.0.0.1:8000/api/config/?config + """ + def get(self, request, *args, **kwargs): if 'config' in request.GET.dict(): - parser = IniParser() - parser.read('/etc/ffplayout/ffplayout.conf') + if os.path.isfile(settings.FFPLAYOUT_CONFIG): + parser = IniParser() + parser.read(settings.FFPLAYOUT_CONFIG) - return Response(parser.as_dict()) + return Response(parser.as_dict()) + else: + return Response({ + "success": False, + "error": "ffpayout engine config file not found!"}) else: return Response({"success": False}) diff --git a/ffplayout/db.sqlite3 b/ffplayout/db.sqlite3 index c061a8698bda6d73bee96a061d0ec9b8e0e66d44..f76bcf4a7abebaaa057ff1349381adebc1741834 100644 GIT binary patch delta 286 zcmZo@;Am*zm>|ulI8nx#QE_9!l6Vd#-WCSFL%b~;8!LDJVNF9EW`P}j&3 z$qI85BTLKX3-h;Mn9pbu05tkA1OFrb!$70A^V`ZXJ2Dy>;Bpv~EVCo0k%6Hl(9ya^ V7C;YJnVMM{S?F1so0wZ#0swvHQjY)t delta 142 zcmZo@;Am*zm>|t4H&Mo!QEp?xl6W>ozC#Rrhc-6u;NxhrW@PnkVRfARpk86~t2`-2 zHb(wC4E%RC3pQNh-+ZV3j=Y4SrLLiouAzy7k%5(|nU#@+o~4