|
75 | 75 | import learning_observer.prestartup |
76 | 76 | import learning_observer.settings as settings |
77 | 77 |
|
| 78 | + |
78 | 79 | @learning_observer.prestartup.register_startup_check |
79 | 80 | def verify_auth_precheck(): |
80 | | - ''' |
81 | | - This is a pre-startup check to make sure that the auth system is configured |
82 | | - correctly. |
83 | | - ''' |
84 | | - # We need some auth |
85 | | - if 'auth' not in settings.settings: |
86 | | - raise learning_observer.prestartup.StartupCheck("Please configure auth") |
87 | | - |
88 | | - # If we have Google oauth, we need it properly configured. |
89 | | - # TODO: Confirm everything works with Google Oauth missing |
90 | | - if 'google_oauth' in settings.settings['auth']: |
91 | | - if 'web' not in settings.settings['auth']['google_oauth'] or \ |
92 | | - 'client_secret' not in settings.settings['auth']['google_oauth']['web'] or \ |
93 | | - 'project_id' not in settings.settings['auth']['google_oauth']['web'] or \ |
94 | | - 'client_id' not in settings.settings['auth']['google_oauth']['web'] or \ |
95 | | - isinstance(settings.settings['auth']['google_oauth']['web']['client_secret'], dict) or \ |
96 | | - isinstance(settings.settings['auth']['google_oauth']['web']['project_id'], dict) or \ |
97 | | - isinstance(settings.settings['auth']['google_oauth']['web']['client_id'], dict): |
98 | | - error = \ |
99 | | - "Please configure (or disable) Google oauth\n" + \ |
100 | | - "\n" + \ |
101 | | - "Go to:\n" + \ |
102 | | - " https://console.developers.google.com/ \n" + \ |
103 | | - "And set up an OAuth client for a web application. Make sure that configuration\n" + \ |
104 | | - "mirrors the one here.\n" + \ |
105 | | - "\n" + \ |
106 | | - "If you are not planning to use Google auth (which is the case for most dev\n" + \ |
107 | | - "settings), please disable Google authentication in creds.yaml" |
108 | | - raise learning_observer.prestartup.StartupCheck(error) |
| 81 | + ''' |
| 82 | + This is a pre-startup check to make sure that the auth system is configured |
| 83 | + correctly. |
| 84 | + ''' |
| 85 | + # We need some auth |
| 86 | + if 'auth' not in settings.settings: |
| 87 | + raise learning_observer.prestartup.StartupCheck( |
| 88 | + "Please configure auth") |
| 89 | + |
| 90 | + # If we have Google oauth, we need it properly configured. |
| 91 | + # TODO: Confirm everything works with Google Oauth missing |
| 92 | + if 'google_oauth' in settings.settings['auth']: |
| 93 | + if 'web' not in settings.settings['auth']['google_oauth'] or \ |
| 94 | + 'client_secret' not in settings.settings['auth']['google_oauth']['web'] or \ |
| 95 | + 'project_id' not in settings.settings['auth']['google_oauth']['web'] or \ |
| 96 | + 'client_id' not in settings.settings['auth']['google_oauth']['web'] or \ |
| 97 | + isinstance(settings.settings['auth']['google_oauth']['web']['client_secret'], dict) or \ |
| 98 | + isinstance(settings.settings['auth']['google_oauth']['web']['project_id'], dict) or \ |
| 99 | + isinstance(settings.settings['auth']['google_oauth']['web']['client_id'], dict): |
| 100 | + error = \ |
| 101 | + "Please configure (or disable) Google oauth\n" + \ |
| 102 | + "\n" + \ |
| 103 | + "Go to:\n" + \ |
| 104 | + " https://console.developers.google.com/ \n" + \ |
| 105 | + "And set up an OAuth client for a web application. Make sure that configuration\n" + \ |
| 106 | + "mirrors the one here.\n" + \ |
| 107 | + "\n" + \ |
| 108 | + "If you are not planning to use Google auth (which is the case for most dev\n" + \ |
| 109 | + "settings), please disable Google authentication in creds.yaml" |
| 110 | + raise learning_observer.prestartup.StartupCheck(error) |
0 commit comments