From 45b0f2e5d186d5707f3c4d9bcf785bb5759f3637 Mon Sep 17 00:00:00 2001 From: Wojciech Bartosiak Date: Sun, 10 Jan 2016 20:58:11 +0000 Subject: [PATCH] Fixed generating key in wrong folder - ignoring value of OIDC_RSA_KEY_FOLDER --- oidc_provider/management/commands/creatersakey.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/oidc_provider/management/commands/creatersakey.py b/oidc_provider/management/commands/creatersakey.py index c6a5352..2f4d29f 100644 --- a/oidc_provider/management/commands/creatersakey.py +++ b/oidc_provider/management/commands/creatersakey.py @@ -1,6 +1,7 @@ +import os from Crypto.PublicKey import RSA -from django.conf import settings +from oidc_provider import settings from django.core.management.base import BaseCommand @@ -10,7 +11,7 @@ class Command(BaseCommand): def handle(self, *args, **options): try: 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: f.write(key.exportKey('PEM')) self.stdout.write('RSA key successfully created at: ' + file_path)