added user management
This commit is contained in:
parent
5cb6bccd7f
commit
531a172eb6
19
.gitignore
vendored
Normal file
19
.gitignore
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# IDE Folders
|
||||||
|
pm/../.idea/
|
||||||
|
|
||||||
|
# PY VENV
|
||||||
|
pm/venv/
|
||||||
|
|
||||||
|
# Tokens and Passwwords
|
||||||
|
pm/essentials/secrets.py
|
||||||
|
|
||||||
|
pm/pollmaster\.log
|
||||||
|
|
||||||
|
pm/cogs/__pycache__/
|
||||||
|
|
||||||
|
pm/essentials/__pycache__/
|
||||||
|
|
||||||
|
pm/utils/__pycache__/
|
||||||
|
|
||||||
|
# export
|
||||||
|
pm/export/*
|
||||||
@ -12,6 +12,9 @@ services:
|
|||||||
- MONGO_INITDB_ROOT_USERNAME
|
- MONGO_INITDB_ROOT_USERNAME
|
||||||
- MONGO_INITDB_ROOT_PASSWORD
|
- MONGO_INITDB_ROOT_PASSWORD
|
||||||
- MONGO_INITDB_DATABASE
|
- MONGO_INITDB_DATABASE
|
||||||
|
ports:
|
||||||
|
- 27017:27107
|
||||||
|
- 27017
|
||||||
|
|
||||||
# App - Container, where the main application runs
|
# App - Container, where the main application runs
|
||||||
app:
|
app:
|
||||||
@ -19,6 +22,7 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ./pm/cogs/poll_controls.py:/data/pm/cogs/poll_controls.py
|
- ./pm/cogs/poll_controls.py:/data/pm/cogs/poll_controls.py
|
||||||
- ./pm/pollmaster.py:/data/pm/pollmaster.py
|
- ./pm/pollmaster.py:/data/pm/pollmaster.py
|
||||||
|
- ./pm/essentials/secrets.py:/data/pm/essentials/secrets.py
|
||||||
links:
|
links:
|
||||||
- mongo
|
- mongo
|
||||||
build:
|
build:
|
||||||
@ -35,6 +39,8 @@ services:
|
|||||||
mongo-express:
|
mongo-express:
|
||||||
image: mongo-express
|
image: mongo-express
|
||||||
restart: always
|
restart: always
|
||||||
|
links:
|
||||||
|
- mongo
|
||||||
ports:
|
ports:
|
||||||
- 8081:8081
|
- 8081:8081
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
7
docker-entrypoint-initdb.d/add_pollmaster_user.js
Normal file
7
docker-entrypoint-initdb.d/add_pollmaster_user.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
db.createUser(
|
||||||
|
{
|
||||||
|
user: "root",
|
||||||
|
pwd: "SetYourOwnPassword",
|
||||||
|
|
||||||
|
roles: [{role: "readWrite", db: "pollmaster"}]
|
||||||
|
})
|
||||||
19
pm/.gitignore
vendored
19
pm/.gitignore
vendored
@ -1,19 +0,0 @@
|
|||||||
# IDE Folders
|
|
||||||
../.idea/
|
|
||||||
|
|
||||||
# PY VENV
|
|
||||||
venv/
|
|
||||||
|
|
||||||
# Tokens and Passwwords
|
|
||||||
essentials/secrets\.py
|
|
||||||
|
|
||||||
pollmaster\.log
|
|
||||||
|
|
||||||
cogs/__pycache__/
|
|
||||||
|
|
||||||
essentials/__pycache__/
|
|
||||||
|
|
||||||
utils/__pycache__/
|
|
||||||
|
|
||||||
# export
|
|
||||||
export/*
|
|
||||||
@ -13,6 +13,8 @@ from motor.motor_asyncio import AsyncIOMotorClient
|
|||||||
from essentials.multi_server import get_pre
|
from essentials.multi_server import get_pre
|
||||||
from essentials.settings import SETTINGS
|
from essentials.settings import SETTINGS
|
||||||
|
|
||||||
|
from pprint import pprint
|
||||||
|
|
||||||
bot_config = {
|
bot_config = {
|
||||||
'command_prefix': get_pre,
|
'command_prefix': get_pre,
|
||||||
'pm_help': False,
|
'pm_help': False,
|
||||||
@ -132,12 +134,17 @@ async def on_guild_join(server):
|
|||||||
|
|
||||||
logger.info("Connecting to Mongo DB: " + SETTINGS.mongo_db)
|
logger.info("Connecting to Mongo DB: " + SETTINGS.mongo_db)
|
||||||
mongo = AsyncIOMotorClient(SETTINGS.mongo_db)
|
mongo = AsyncIOMotorClient(SETTINGS.mongo_db)
|
||||||
|
|
||||||
|
pprint(mongo)
|
||||||
|
|
||||||
bot.db = mongo.pollmaster
|
bot.db = mongo.pollmaster
|
||||||
print(bot.db)
|
print(bot.db)
|
||||||
|
pprint(bot.db)
|
||||||
|
|
||||||
extensions = ['cogs.config', 'cogs.poll_controls', 'cogs.help', 'cogs.db_api', 'cogs.admin']
|
extensions = ['cogs.config', 'cogs.poll_controls', 'cogs.help', 'cogs.db_api', 'cogs.admin']
|
||||||
for ext in extensions:
|
for ext in extensions:
|
||||||
logger.info("Loading extension " + ext)
|
logger.info("Loading extension " + ext)
|
||||||
bot.load_extension(ext)
|
bot.load_extension(ext)
|
||||||
|
|
||||||
|
pprint(SETTINGS.bot_token)
|
||||||
bot.run(SETTINGS.bot_token)
|
bot.run(SETTINGS.bot_token)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user