Skip to content
This repository has been archived by the owner on Jan 7, 2022. It is now read-only.

#29 Nakadi SQL Query tab and server support added #30

Merged
merged 19 commits into from
Nov 16, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
#29 Nakadi SQL feature flag
  • Loading branch information
SergKam committed Nov 5, 2018
commit f1826d92bb06f59cfa9db444c1f851898f67f0a6
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ SUPPORT_URL=https://hipchat.example.com/chat/room/12345
ALLOW_DELETE_EVENT_TYPE=yes
FORBID_DELETE_URL=https://nakadi-faq.docs.example.com/#how-to-delete-et

NAKADI_SQL_API_URL="http://nakadi-sql.example.com"
SHOW_NAKADI_SQL=no

MONITORING_URL="https://zmon.example.com/grafana/dashboard/db/nakadi-live"
SLO_MONITORING_URL="https://zmon.example.com/grafana/dashboard/db/nakadi-slos"
EVENT_TYPE_MONITORING_URL="https://zmon.example.com/grafana/dashboard/db/nakadi-et/?var-stack=nakadi-live&var-et={et}"
Expand Down
1 change: 1 addition & 0 deletions client/User/Commands.elm
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ settingsDecoder =
|> optional "supportUrl" string emptyString
|> optional "forbidDeleteUrl" string emptyString
|> optional "allowDeleteEvenType" bool False
|> optional "showNakadiSql" bool False


{-| Redirect browser to logout
Expand Down
2 changes: 2 additions & 0 deletions client/User/Models.elm
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ type alias Settings =
, supportUrl : String
, forbidDeleteUrl : String
, allowDeleteEvenType : Bool
, showNakadiSql: Bool
}


Expand All @@ -69,4 +70,5 @@ initialSettings =
, supportUrl = emptyString
, forbidDeleteUrl = emptyString
, allowDeleteEvenType = False
, showNakadiSql = False
}
3 changes: 2 additions & 1 deletion server/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ exports = module.exports = function createConfiguration(env) {
docsUrl: optional('DOCS_URL', env, ''),
supportUrl: optional('SUPPORT_URL', env, ''),
allowDeleteEvenType: envToBool(env.ALLOW_DELETE_EVENT_TYPE),
forbidDeleteUrl: optional('FORBID_DELETE_URL', env, '')
forbidDeleteUrl: optional('FORBID_DELETE_URL', env, ''),
showNakadiSql: envToBool(env.SHOW_NAKADI_SQL),
},

authorize: {
Expand Down
11 changes: 5 additions & 6 deletions server/nakadiSqlApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ const proxy = require('express-http-proxy');
const logger = require('./logger');

module.exports = function NakadiSqlProxyRoute(config) {

if (!config.nakadiApiSqlUrl){
return []
}

return [
authorization(config.authorize),
proxy(config.nakadiApiSqlUrl, {
Expand All @@ -23,12 +28,6 @@ module.exports = function NakadiSqlProxyRoute(config) {
return;
}

// Workaround for https://github.com/zalando/nakadi/issues/792
// Nakadi doesn't accept fake tokens even with NAKADI_OAUTH2_MODE=OFF
if (origReq.authorizationToken === '__NONE__') {
return proxyReq;
}

proxyReq.headers['Authorization'] = 'Bearer ' + origReq.authorizationToken;
return proxyReq;
}
Expand Down
4 changes: 3 additions & 1 deletion tests/mocks/data/appConf.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"port": "3000",
"baseUrl": "http://localhost:3000",
"nakadiApiUrl": "http://localhost:5341",
"nakadiApiSqlUrl": "http://localhost:6341",
"serverOptions": {},
"auth": {
"strategy": "../tests/mocks/testPassportStrategy",
Expand All @@ -21,7 +22,8 @@
"sloMonitoringUrl": "https://zmon.example.com/grafana/dashboard/db/nakadi-slos",
"eventTypeMonitoringUrl": "https://zmon.example.com/grafana/dashboard/db/nakadi-et/?var-stack=nakadi-staging&var-et={et}",
"subscriptionMonitoringUrl": "https://zmon.example.com/grafana/dashboard/db/nakadi-subscription/?var-stack=nakadi-staging&var-id={id}",
"allowDeleteEvenType": true
"allowDeleteEvenType": true,
"showNakadiSql": true
},
"logsApi": {
"scalyrUrl": "http://localhost:5342",
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/config.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ describe('Config', function() {
port: '3000',
baseUrl: 'https://localhost:3000',
nakadiApiUrl: 'https://nakadi-staging.example.com',
nakadiApiSqlUrl:'',
serverOptions: {
key: 'test fake private certificate',
cert: 'test fake public certificate'
Expand All @@ -67,7 +68,8 @@ describe('Config', function() {
docsUrl: "https://nakadi-faq.docs.example.com/",
supportUrl: "https://hipchat.example.com/chat/room/12345",
forbidDeleteUrl: "https://nakadi-faq.docs.example.com/#how-to-delete-et",
allowDeleteEvenType: true
allowDeleteEvenType: true,
showNakadiSql: false
},
authorize: {
strategy: 'myGoogleAdapter',
Expand Down