Fixed generating key in wrong folder - ignoring value of OIDC_RSA_KEY_FOLDER
This commit is contained in:
parent
fdcbecbead
commit
45b0f2e5d1
1 changed files with 3 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
||||||
|
import os
|
||||||
from Crypto.PublicKey import RSA
|
from Crypto.PublicKey import RSA
|
||||||
|
|
||||||
from django.conf import settings
|
from oidc_provider import settings
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,7 +11,7 @@ class Command(BaseCommand):
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
try:
|
try:
|
||||||
key = RSA.generate(1024)
|
key = RSA.generate(1024)
|
||||||
file_path = settings.BASE_DIR + '/OIDC_RSA_KEY.pem'
|
file_path = os.path.join(settings.get('OIDC_RSA_KEY_FOLDER'), 'OIDC_RSA_KEY.pem')
|
||||||
with open(file_path, 'wb') as f:
|
with open(file_path, 'wb') as f:
|
||||||
f.write(key.exportKey('PEM'))
|
f.write(key.exportKey('PEM'))
|
||||||
self.stdout.write('RSA key successfully created at: ' + file_path)
|
self.stdout.write('RSA key successfully created at: ' + file_path)
|
||||||
|
|
Loading…
Reference in a new issue