예제 #1
0
    def test_generated_or_file_key(self):
        """Reading key from a file."""

        KEY_FILE = ".test_secret_key_store"

        key = secret_key.generate_or_read_from_file(KEY_FILE)

        # Consecutive reads should come from the already existing file:
        self.assertEqual(key, secret_key.generate_or_read_from_file(KEY_FILE))

        # Key file only be read/writable by user:
        self.assertEqual(oct(os.stat(KEY_FILE).st_mode & 0o777), "0600")
        os.chmod(KEY_FILE, 0o777)
        self.assertRaises(secret_key.FilePermissionError, secret_key.generate_or_read_from_file, KEY_FILE)
        os.remove(KEY_FILE)
예제 #2
0
    def test_generated_or_file_key(self):
        """Reading key from a file."""

        KEY_FILE = ".test_secret_key_store"

        key = secret_key.generate_or_read_from_file(KEY_FILE)

        # Consecutive reads should come from the already existing file:
        self.assertEqual(key, secret_key.generate_or_read_from_file(KEY_FILE))

        # Key file only be read/writable by user:
        self.assertEqual(oct(os.stat(KEY_FILE).st_mode & 0o777), "0600")
        os.chmod(KEY_FILE, 0o777)
        self.assertRaises(secret_key.FilePermissionError,
                          secret_key.generate_or_read_from_file, KEY_FILE)
        os.remove(KEY_FILE)
예제 #3
0
        "PORT": '5432',
    }
}

SECRET_KEY = None
LOCAL_PATH = '/tmp'

# Ensure that we always have a SECRET_KEY set, even when no local_settings.py
# file is present. See local_settings.py.example for full documentation on the
# horizon.utils.secret_key module and its use.
if not SECRET_KEY:
    if not LOCAL_PATH:
        LOCAL_PATH = os.path.dirname(os.path.abspath(__file__))

    from goldstone.libs import secret_key
    SECRET_KEY = secret_key.generate_or_read_from_file(os.path.join(LOCAL_PATH,
                                                       '.secret_key_store'))


STATIC_ROOT = '/usr/share/nginx/html/static'
STATIC_URL = '/static/'

# Settings for the Djoser package, which is used for login and
# password-resetting. We automatically login and activate after registration.
#
# Please review the DOMAIN value.
# Please review the SITE_NAME value.
DJOSER = {'DOMAIN': os.environ.get('EXTERNAL_HOSTNAME', getfqdn()),
          'SITE_NAME': 'Goldstone',
          'PASSWORD_RESET_CONFIRM_URL':
          'password/confirm/?uid={uid}&token={token}',
          'ACTIVATION_URL': '#/activate/{uid}/{token}',
예제 #4
0
        "HOST": "127.0.0.1",
        "PORT": '5432',
    }
}

SECRET_KEY = None
LOCAL_PATH = None

# Ensure that we always have a SECRET_KEY set, even when no local_settings.py
# file is present. See local_settings.py.example for full documentation on the
# horizon.utils.secret_key module and its use.
if not SECRET_KEY:
    if not LOCAL_PATH:
        LOCAL_PATH = os.path.dirname(os.path.abspath(__file__))

    SECRET_KEY = secret_key.generate_or_read_from_file(
        os.path.join(LOCAL_PATH, '.secret_key_store'))

STATIC_ROOT = '/var/www/goldstone/static/'
STATIC_URL = '/static/'

# Settings for the Djoser package, which is used for login and
# password-resetting, are in base.py. If you need to change any of its values,
# override them here.

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'formatters': {
        'brief': {
            'format': '%(levelname)s %(message)s'
        },