make pipisa secure
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
hogweed1 2024-07-03 17:38:45 +10:00
parent 55e5303ab2
commit d41eeb3232
4 changed files with 32 additions and 8 deletions

View File

@ -24,6 +24,11 @@ steps:
when:
branch:
- main
environment:
ARANGO_PASSWORD:
from_secret: arango-pwd
ARANGO_USERNAME:
from_secret: arango-usr
- name: restart systemd unit
commands:
- systemctl restart jack_bot

View File

@ -1,8 +1,8 @@
---
databaso:
host: 'https://arango.guaranteedstruggle.host'
user: root
pass: stolendick527
#user: root
#pass: stolendick527
base: pipisa
collection: dicks
posts_removal_collection: posts_removal

View File

@ -5,7 +5,7 @@ from global_conf import CONFIG
from arango import ArangoClient
import logging
import os
def get_dicks_collection():
@ -13,8 +13,10 @@ def get_dicks_collection():
arango_client = ArangoClient(hosts=CONFIG['databaso']['host'] )
pipisa_db = arango_client.db(
CONFIG['databaso']['base'],
username=CONFIG['databaso']['user'],
password=CONFIG['databaso']['pass']
username=os.environ['ARANGO_USR'],
password=os.environ['ARANGO_PWD'],
#username=CONFIG['databaso']['user'],
#password=CONFIG['databaso']['pass']
)
dicks_collection = pipisa_db.collection(CONFIG['databaso']['collection'])
@ -28,9 +30,11 @@ def get_posts_removal_collection():
try:
arango_client = ArangoClient(hosts=CONFIG['databaso']['host'] )
pipisa_db = arango_client.db(
CONFIG['databaso']['base'],
username=CONFIG['databaso']['user'],
password=CONFIG['databaso']['pass']
CONFIG['databaso']['base'],
username=os.environ['ARANGO_USR'],
password=os.environ['ARANGO_PWD'],
#username=CONFIG['databaso']['user'],
#password=CONFIG['databaso']['pass']
)
posts_removal_collection = pipisa_db.collection(CONFIG['databaso']['posts_removal_collection'])

15
jack_bot.service Normal file
View File

@ -0,0 +1,15 @@
# пример того что лежит на хосте
[Unit]
Description=pipisa-bot
After=network.target
[Service]
User=jack
Type=simple
Restart=always
WorkingDirectory=/usr/share/python_bot
ExecStart=/usr/bin/python3 /usr/share/python_bot/bot.py
ExecStart=/usr/bin/python3 /usr/share/python_bot/bot.py
[Install]
WantedBy=multi-user.target#