configs and experiments
This commit is contained in:
parent
6b95a74681
commit
c4b65ff11f
@ -31,6 +31,7 @@ services:
|
||||
RABBITMQ_PASSWORD: $RABBITMQ_PASSWORD_DEV
|
||||
VK_SERVICE_TOKEN: $VK_SERVICE_TOKEN
|
||||
YANDEX_SERVICE_TOKEN: $YANDEX_SERVICE_TOKEN
|
||||
PLATFORM_SECURITY_TOKEN: $PLATFORM_SECURITY_TOKEN
|
||||
command: runserver 0.0.0.0:8000
|
||||
healthcheck:
|
||||
test: curl --fail http://0.0.0.0:8000/ping || exit 1
|
||||
|
@ -36,6 +36,7 @@ services:
|
||||
VK_SERVICE_TOKEN: $VK_SERVICE_TOKEN
|
||||
YANDEX_SERVICE_TOKEN: $YANDEX_SERVICE_TOKEN
|
||||
TELEGRAM_TOKEN: $TELEGRAM_TOKEN
|
||||
PLATFORM_SECURITY_TOKEN: $PLATFORM_SECURITY_TOKEN
|
||||
command: runserver 0.0.0.0:8000
|
||||
healthcheck:
|
||||
test: curl --fail http://0.0.0.0:8000/ping || exit 1
|
||||
|
@ -148,3 +148,5 @@ MINIO_BUCKET_NAME = 'platform'
|
||||
|
||||
VK_SERVICE_TOKEN = os.getenv("VK_SERVICE_TOKEN", None)
|
||||
YANDEX_SERVICE_TOKEN = os.getenv("YANDEX_SERVICE_TOKEN", None)
|
||||
|
||||
PLATFORM_SECURITY_TOKEN = os.getenv("PLATFORM_SECURITY_TOKEN", None)
|
||||
|
@ -4,5 +4,6 @@ from django.urls import path
|
||||
from .views import *
|
||||
|
||||
urlpatterns = [
|
||||
path(*ConfigsView.as_path())
|
||||
path(*ConfigsView.as_path()),
|
||||
path('get', get_config)
|
||||
]
|
||||
|
@ -1,6 +1,9 @@
|
||||
from json import loads
|
||||
|
||||
from django.http import HttpResponse, JsonResponse
|
||||
|
||||
from BaseLib.BaseView import BaseView
|
||||
from Platform import settings
|
||||
from configs.models import Config
|
||||
|
||||
|
||||
@ -41,3 +44,17 @@ class ConfigsView(BaseView):
|
||||
config.data = data
|
||||
config.save()
|
||||
return '/configs/?stage=' + config.stage
|
||||
|
||||
|
||||
def get_config(request):
|
||||
if request.headers.get("X-Security-Token") != settings.PLATFORM_SECURITY_TOKEN:
|
||||
return HttpResponse('', status=403)
|
||||
project = request.GET.get('project')
|
||||
stage = request.GET.get('stage')
|
||||
name = request.GET.get('name')
|
||||
if project is None or stage is None or name is None:
|
||||
return HttpResponse('', status=400)
|
||||
config = Config.objects.filter(stage=stage, project=project, name=name).first()
|
||||
if config is None:
|
||||
return HttpResponse('', status=404)
|
||||
return JsonResponse(config.data)
|
||||
|
@ -4,5 +4,6 @@ from django.urls import path
|
||||
from .views import *
|
||||
|
||||
urlpatterns = [
|
||||
path(*ExperimentsView.as_path())
|
||||
path(*ExperimentsView.as_path()),
|
||||
path('get', get_experiment)
|
||||
]
|
||||
|
@ -1,4 +1,7 @@
|
||||
from django.http import HttpResponse, JsonResponse
|
||||
|
||||
from BaseLib.BaseView import BaseView
|
||||
from Platform import settings
|
||||
from experiments.models import Experiment
|
||||
|
||||
|
||||
@ -39,4 +42,21 @@ class ExperimentsView(BaseView):
|
||||
else:
|
||||
exp.condition = 'True'
|
||||
exp.save()
|
||||
return '/experiments/?stage=' + self.stage
|
||||
return '/experiments/?stage=' + self.stage
|
||||
|
||||
|
||||
def get_experiment(request):
|
||||
if request.headers.get("X-Security-Token") != settings.PLATFORM_SECURITY_TOKEN:
|
||||
return HttpResponse('', status=403)
|
||||
project = request.GET.get('project')
|
||||
stage = request.GET.get('stage')
|
||||
name = request.GET.get('name')
|
||||
if project is None or stage is None or name is None:
|
||||
return HttpResponse('', status=400)
|
||||
experiment = Experiment.objects.filter(stage=stage, project=project, name=name).first()
|
||||
if experiment is None:
|
||||
return HttpResponse('', status=404)
|
||||
return JsonResponse({
|
||||
'enabled': experiment.enabled,
|
||||
'condition': experiment.condition
|
||||
})
|
||||
|
@ -7,7 +7,7 @@
|
||||
<div class="row">
|
||||
<div class="col-3">
|
||||
<div style="height: 100%; width: 100%;">
|
||||
<img src="{{ user.profile_photo_url }}" height="100%" width="100%" alt="Фото профиля">
|
||||
<img src="{{ account.profile_photo_url }}" height="100%" width="100%" alt="Фото профиля">
|
||||
</div>
|
||||
{% if owner %}
|
||||
<label for="file-upload" class="btn btn-gray-50" style="margin-top: -120px; margin-left: 20%; width: 60%;">
|
||||
@ -22,7 +22,7 @@
|
||||
</div>
|
||||
<div class="col-9">
|
||||
<h3>
|
||||
{{ account.userinfo.surname }} {{ account.userinfo.name }}
|
||||
{{ account.surname }} {{ account.name }}
|
||||
<span style="margin-left: 15px; margin-bottom: 20px;" class="badge bg-{% if account.userinfo.activity_status == online_status %}success{% else %}secondary{% endif %}">{{ account.userinfo.activity_status }}</span>
|
||||
</h3>
|
||||
<table>
|
||||
@ -55,9 +55,6 @@
|
||||
{% if account.vk_id %}
|
||||
<div style="margin-top: -15px; margin-left: 30px;"><i style="color: green;" class="fa fa-check-circle"></i></div>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td><div style="width: 20px;"></div></td>
|
||||
<td>
|
||||
<a href="https://oauth.yandex.ru/authorize?response_type=code&client_id=38f1906e99de4810bd79828f420ba885&redirect_uri=https://platform.sprinthub.ru/yandex_auth"><img style="width: 40px; height: 40px;" src="https://upload.wikimedia.org/wikipedia/commons/thumb/5/58/Yandex_icon.svg/2048px-Yandex_icon.svg.png"></a>
|
||||
{% if account.yandex_id %}
|
||||
<div style="margin-top: -15px; margin-left: 30px;"><i style="color: green;" class="fa fa-check-circle"></i></div>
|
||||
|
Loading…
Reference in New Issue
Block a user