File tree Expand file tree Collapse file tree 5 files changed +8
-14
lines changed
Expand file tree Collapse file tree 5 files changed +8
-14
lines changed Original file line number Diff line number Diff line change @@ -6,4 +6,3 @@ DB_PORT=5432
66USERNAME = " piccolo"
77PASSWORD = " piccolo123"
889- ENCRIPTION_KEY = " \xb7(\xa5\xa6\xa4&\xeb\x8eI\xfe_Y\x16\x12\xf4\xf4\xa8|\xc6#\xd1\x02\xa2s\x03]\xea\x12\xb9\xf1\xa2\xb3"
Original file line number Diff line number Diff line change 1- FROM python:3.11
1+ FROM python:3.11-slim
22
33WORKDIR /code
44
Original file line number Diff line number Diff line change @@ -11,10 +11,9 @@ git clone https://github.com/piccolo-orm/piccolo-admin-docker.git
1111Creating an ` .env ` file.
1212
1313``` bash
14- cd app
1514cp .env.example .env && rm .env.example
16- cd ..
1715```
16+
1817Creating a Docker image.
1918
2019``` bash
@@ -24,7 +23,7 @@ docker build -t piccolo_admin .
2423Running a Docker image (use the ` --network=host ` flag for an existing database from the local machine).
2524
2625``` bash
27- docker run -d --network=host --name admin_container piccolo_admin
26+ docker run --env-file .env - d --network=host --name admin_container piccolo_admin
2827```
2928
3029After site is running log in as admin user on [ localhost:8000] ( http://localhost:8000/admin/ ) and use legacy database.
Original file line number Diff line number Diff line change 11import asyncio
22import os
33
4- from dotenv import find_dotenv , load_dotenv
54from hypercorn import Config
65from hypercorn .asyncio import serve
76from piccolo .apps .user .tables import BaseUser
2019DB = SQLiteEngine ()
2120
2221
23- load_dotenv (find_dotenv ())
24-
25-
2622class Sessions (SessionsBase , db = DB ):
2723 pass
2824
@@ -75,6 +71,9 @@ async def main():
7571 for table_class in found_tables :
7672 table_class ._meta ._db = db
7773
74+ # create new encription key for MFA
75+ encryption_key = XChaCha20Provider .get_new_key ()
76+
7877 app = create_admin (
7978 found_tables ,
8079 auth_table = User ,
@@ -83,9 +82,7 @@ async def main():
8382 mfa_providers = [
8483 AuthenticatorProvider (
8584 encryption_provider = XChaCha20Provider (
86- encryption_key = os .environb [b"ENCRIPTION_KEY" ]
87- .decode ("unicode-escape" )
88- .encode ("latin-1" )
85+ encryption_key = encryption_key ,
8986 ),
9087 secret_table = AuthenticatorSecret ,
9188 ),
Original file line number Diff line number Diff line change @@ -3,5 +3,4 @@ aiosqlite
33hypercorn
44piccolo
55piccolo-admin
6- piccolo_api [authenticator,pynacl ]
7- python-dotenv
6+ piccolo_api [authenticator,pynacl ]
You can’t perform that action at this time.
0 commit comments