nginx
This commit is contained in:
parent
8fb83f44f9
commit
9ba5067ae6
2 changed files with 9 additions and 4 deletions
|
@ -10,7 +10,7 @@ COPY static ./static
|
||||||
COPY requirements.txt main.py database.sqlite ./
|
COPY requirements.txt main.py database.sqlite ./
|
||||||
RUN apt update
|
RUN apt update
|
||||||
|
|
||||||
# Install supervisords
|
# Install supervisord
|
||||||
RUN apt install -y supervisor
|
RUN apt install -y supervisor
|
||||||
COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||||
COPY config/cmd.sh /cmd.sh
|
COPY config/cmd.sh /cmd.sh
|
||||||
|
|
|
@ -14,6 +14,7 @@ import re
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
from api.utils import shell_execute, docker, const
|
from api.utils import shell_execute, docker, const
|
||||||
from api.model.app import App
|
from api.model.app import App
|
||||||
|
from api.service import db
|
||||||
from api.model.response import Response
|
from api.model.response import Response
|
||||||
from api.model.config import Config
|
from api.model.config import Config
|
||||||
from api.model.status_reason import StatusReason
|
from api.model.status_reason import StatusReason
|
||||||
|
@ -44,6 +45,8 @@ scheduler = BackgroundScheduler()
|
||||||
scheduler.add_job(auto_update, 'cron', hour=1)
|
scheduler.add_job(auto_update, 'cron', hour=1)
|
||||||
scheduler.start()
|
scheduler.start()
|
||||||
|
|
||||||
|
nginx_token = None
|
||||||
|
|
||||||
# 获取github文件内容
|
# 获取github文件内容
|
||||||
def get_github_content(repo, path):
|
def get_github_content(repo, path):
|
||||||
url = 'https://websoft9.github.io/{repo}/{path}'
|
url = 'https://websoft9.github.io/{repo}/{path}'
|
||||||
|
@ -1108,10 +1111,10 @@ def check_real_domain(domain):
|
||||||
|
|
||||||
|
|
||||||
def get_token():
|
def get_token():
|
||||||
url = 'http://172.17.0.1:9092/api/tokens'
|
url = const.NGINX_URL+"/api/tokens"
|
||||||
headers = {'Content-type': 'application/json'}
|
headers = {'Content-type': 'application/json'}
|
||||||
cmd = "cat /usr/share/cockpit/myapps/config.json | jq -r '.NGINXPROXYMANAGER.NGINXPROXYMANAGER_PASSWORD'"
|
password = db.AppSearchUsers("nginx").json()["password"]
|
||||||
password = shell_execute.execute_command_output_all(cmd)["result"].rstrip('\n')
|
|
||||||
myLogger.info_logger(password)
|
myLogger.info_logger(password)
|
||||||
param = {
|
param = {
|
||||||
"identity": "help@websoft9.com",
|
"identity": "help@websoft9.com",
|
||||||
|
@ -1120,6 +1123,8 @@ def get_token():
|
||||||
}
|
}
|
||||||
response = requests.post(url, data=json.dumps(param), headers=headers)
|
response = requests.post(url, data=json.dumps(param), headers=headers)
|
||||||
|
|
||||||
|
nginx_token = response.json()
|
||||||
|
myLogger.info_logger(nginx_token)
|
||||||
token = "Bearer " + response.json()["token"]
|
token = "Bearer " + response.json()["token"]
|
||||||
return token
|
return token
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue