make pipisa secure

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: when:
branch: branch:
- main - main
environment:
ARANGO_PASSWORD:
from_secret: arango-pwd
ARANGO_USERNAME:
from_secret: arango-usr
- name: restart systemd unit - name: restart systemd unit
commands: commands:
- systemctl restart jack_bot - systemctl restart jack_bot

View File

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

View File

@ -5,7 +5,7 @@ from global_conf import CONFIG
from arango import ArangoClient from arango import ArangoClient
import logging import logging
import os
def get_dicks_collection(): def get_dicks_collection():
@ -13,8 +13,10 @@ def get_dicks_collection():
arango_client = ArangoClient(hosts=CONFIG['databaso']['host'] ) arango_client = ArangoClient(hosts=CONFIG['databaso']['host'] )
pipisa_db = arango_client.db( pipisa_db = arango_client.db(
CONFIG['databaso']['base'], CONFIG['databaso']['base'],
username=CONFIG['databaso']['user'], username=os.environ['ARANGO_USR'],
password=CONFIG['databaso']['pass'] password=os.environ['ARANGO_PWD'],
#username=CONFIG['databaso']['user'],
#password=CONFIG['databaso']['pass']
) )
dicks_collection = pipisa_db.collection(CONFIG['databaso']['collection']) dicks_collection = pipisa_db.collection(CONFIG['databaso']['collection'])
@ -29,8 +31,10 @@ def get_posts_removal_collection():
arango_client = ArangoClient(hosts=CONFIG['databaso']['host'] ) arango_client = ArangoClient(hosts=CONFIG['databaso']['host'] )
pipisa_db = arango_client.db( pipisa_db = arango_client.db(
CONFIG['databaso']['base'], CONFIG['databaso']['base'],
username=CONFIG['databaso']['user'], username=os.environ['ARANGO_USR'],
password=CONFIG['databaso']['pass'] password=os.environ['ARANGO_PWD'],
#username=CONFIG['databaso']['user'],
#password=CONFIG['databaso']['pass']
) )
posts_removal_collection = pipisa_db.collection(CONFIG['databaso']['posts_removal_collection']) 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#