Change: remove deprecated settings

This commit is contained in:
Arik Fraimovich 2016-10-05 17:15:46 +03:00
parent 7de2d6c101
commit c8b62755d0
5 changed files with 24 additions and 37 deletions

View File

@ -42,11 +42,6 @@ The follow is a list of settings and what they control:
- **REDASH_MAIL_MAX_EMAILS**: *default None*
- **REDASH_MAIL_ASCII_ATTACHMENTS**: *default "false"*
- **REDASH_HOST**: *default ""*
- **REDASH_HIPCHAT_API_TOKEN**: *default None*
- **REDASH_HIPCHAT_API_URL**: *default None*
- **REDASH_HIPCHAT_ROOM_ID**: *default None*
- **REDASH_WEBHOOK_ENDPOINT**: *default None*
- **REDASH_WEBHOOK_USERNAME**: *default None*
- **REDASH_CORS_ACCESS_CONTROL_ALLOW_ORIGIN**: *default ""*
- **REDASH_CORS_ACCESS_CONTROL_ALLOW_CREDENTIALS**: *default "false"*
- **REDASH_CORS_ACCESS_CONTROL_REQUEST_METHOD**: *default GET, POST, PUT""*

View File

@ -1,7 +1,11 @@
import os
from redash.models import db, Organization, Group
from redash import settings
from playhouse.migrate import PostgresqlMigrator, migrate
# The following is deprecated and should be defined with the Organization object
GOOGLE_APPS_DOMAIN = settings.set_from_string(os.environ.get("REDASH_GOOGLE_APPS_DOMAIN", ""))
if __name__ == '__main__':
migrator = PostgresqlMigrator(db.database)
@ -9,7 +13,7 @@ if __name__ == '__main__':
Organization.create_table()
default_org = Organization.create(name="Default", slug='default', settings={
Organization.SETTING_GOOGLE_APPS_DOMAINS: list(settings.GOOGLE_APPS_DOMAIN)
Organization.SETTING_GOOGLE_APPS_DOMAINS: list(GOOGLE_APPS_DOMAIN)
})
column = Group.org

View File

@ -1,10 +1,18 @@
import os
import peewee
from redash import settings
from redash.models import db, NotificationDestination, AlertSubscription, Alert, Organization, User
from redash.destinations import get_configuration_schema_for_destination_type
from redash.utils.configuration import ConfigurationContainer
from playhouse.migrate import PostgresqlMigrator, migrate
HIPCHAT_API_TOKEN = os.environ.get('REDASH_HIPCHAT_API_TOKEN', None)
HIPCHAT_API_URL = os.environ.get('REDASH_HIPCHAT_API_URL', None)
HIPCHAT_ROOM_ID = os.environ.get('REDASH_HIPCHAT_ROOM_ID', None)
WEBHOOK_ENDPOINT = os.environ.get('REDASH_WEBHOOK_ENDPOINT', None)
WEBHOOK_USERNAME = os.environ.get('REDASH_WEBHOOK_USERNAME', None)
WEBHOOK_PASSWORD = os.environ.get('REDASH_WEBHOOK_PASSWORD', None)
if __name__ == '__main__':
migrator = PostgresqlMigrator(db.database)
with db.database.transaction():
@ -24,13 +32,13 @@ if __name__ == '__main__':
print "!!! Warning: failed finding default organization or admin user, won't migrate Webhook/HipChat alert subscriptions."
exit()
if settings.WEBHOOK_ENDPOINT:
if WEBHOOK_ENDPOINT:
# Have all existing alerts send to webhook if already configured
schema = get_configuration_schema_for_destination_type('webhook')
conf = {'url': settings.WEBHOOK_ENDPOINT}
if settings.WEBHOOK_USERNAME:
conf['username'] = settings.WEBHOOK_USERNAME
conf['password'] = settings.WEBHOOK_PASSWORD
conf = {'url': WEBHOOK_ENDPOINT}
if WEBHOOK_USERNAME:
conf['username'] = WEBHOOK_USERNAME
conf['password'] = WEBHOOK_PASSWORD
options = ConfigurationContainer(conf, schema)
webhook = NotificationDestination.create(
@ -48,18 +56,18 @@ if __name__ == '__main__':
alert=alert
)
if settings.HIPCHAT_API_TOKEN:
if HIPCHAT_API_TOKEN:
# Have all existing alerts send to HipChat if already configured
schema = get_configuration_schema_for_destination_type('hipchat')
conf = {}
if settings.HIPCHAT_API_URL:
if HIPCHAT_API_URL:
conf['url'] = '{url}/room/{room_id}/notification?auth_token={token}'.format(
url=settings.HIPCHAT_API_URL, room_id=settings.HIPCHAT_ROOM_ID, token=settings.HIPCHAT_API_TOKEN)
url=HIPCHAT_API_URL, room_id=HIPCHAT_ROOM_ID, token=HIPCHAT_API_TOKEN)
else:
conf['url'] = 'https://hipchat.com/v2/room/{room_id}/notification?auth_token={token}'.format(
room_id=settings.HIPCHAT_ROOM_ID, token=settings.HIPCHAT_API_TOKEN)
room_id=HIPCHAT_ROOM_ID, token=HIPCHAT_API_TOKEN)
options = ConfigurationContainer(conf, schema)

View File

@ -16,14 +16,6 @@ from redash.destinations import import_destinations
__version__ = '0.12.0'
if settings.FEATURE_TABLES_PERMISSIONS:
# TODO(@arikfr): remove this warning on next version release
print "You have table based permissions enabled, but this feature was removed."
print "Please use new data sources based permission model."
print "(re:dash won't load until you turn off this feature)"
exit(1)
def setup_logging():
handler = logging.StreamHandler()
formatter = logging.Formatter('[%(asctime)s][PID:%(process)d][%(levelname)s][%(name)s] %(message)s')

View File

@ -52,7 +52,7 @@ def all_settings():
return settings
NAME = os.environ.get('REDASH_NAME', 're:dash')
NAME = os.environ.get('REDASH_NAME', 'Redash')
LOGO_URL = os.environ.get('REDASH_LOGO_URL', '/images/redash_icon_small.png')
REDIS_URL = os.environ.get('REDASH_REDIS_URL', os.environ.get('REDIS_URL', "redis://localhost:6379/0"))
@ -83,9 +83,6 @@ ENFORCE_HTTPS = parse_boolean(os.environ.get("REDASH_ENFORCE_HTTPS", "false"))
MULTI_ORG = parse_boolean(os.environ.get("REDASH_MULTI_ORG", "false"))
# The following is deprecated and should be defined with the Organization object
GOOGLE_APPS_DOMAIN = set_from_string(os.environ.get("REDASH_GOOGLE_APPS_DOMAIN", ""))
GOOGLE_CLIENT_ID = os.environ.get("REDASH_GOOGLE_CLIENT_ID", "")
GOOGLE_CLIENT_SECRET = os.environ.get("REDASH_GOOGLE_CLIENT_SECRET", "")
GOOGLE_OAUTH_ENABLED = GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET
@ -143,14 +140,6 @@ MAIL_ASCII_ATTACHMENTS = parse_boolean(os.environ.get('REDASH_MAIL_ASCII_ATTACHM
HOST = os.environ.get('REDASH_HOST', '')
HIPCHAT_API_TOKEN = os.environ.get('REDASH_HIPCHAT_API_TOKEN', None)
HIPCHAT_API_URL = os.environ.get('REDASH_HIPCHAT_API_URL', None)
HIPCHAT_ROOM_ID = os.environ.get('REDASH_HIPCHAT_ROOM_ID', None)
WEBHOOK_ENDPOINT = os.environ.get('REDASH_WEBHOOK_ENDPOINT', None)
WEBHOOK_USERNAME = os.environ.get('REDASH_WEBHOOK_USERNAME', None)
WEBHOOK_PASSWORD = os.environ.get('REDASH_WEBHOOK_PASSWORD', None)
# CORS settings for the Query Result API (and possbily future external APIs).
# In most cases all you need to do is set REDASH_CORS_ACCESS_CONTROL_ALLOW_ORIGIN
# to the calling domain (or domains in a comma separated list).
@ -211,7 +200,6 @@ DATE_FORMAT = os.environ.get("REDASH_DATE_FORMAT", "DD/MM/YY")
# Features:
FEATURE_ALLOW_ALL_TO_EDIT_QUERIES = parse_boolean(os.environ.get("REDASH_FEATURE_ALLOW_ALL_TO_EDIT", "true"))
FEATURE_TABLES_PERMISSIONS = parse_boolean(os.environ.get("REDASH_FEATURE_TABLES_PERMISSIONS", "false"))
VERSION_CHECK = parse_boolean(os.environ.get("REDASH_VERSION_CHECK", "true"))
FEATURE_DISABLE_REFRESH_QUERIES = parse_boolean(os.environ.get("REDASH_FEATURE_DISABLE_REFRESH_QUERIES", "false"))