This repository was archived by the owner on Jun 4, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +22
-13
lines changed Expand file tree Collapse file tree 5 files changed +22
-13
lines changed Original file line number Diff line number Diff line change @@ -52,4 +52,4 @@ RUN yarn run heroku-postbuild
52
52
53
53
ENV PLOTLY_CONNECTOR_PORT 9494
54
54
EXPOSE 9494
55
- ENTRYPOINT yarn run start-headless
55
+ ENTRYPOINT yarn run build-web && yarn run start-headless
Original file line number Diff line number Diff line change @@ -14,7 +14,8 @@ class Configuration extends Component {
14
14
this . state = {
15
15
isMenuOpen : false ,
16
16
username : cookie . load ( 'db-connector-user' ) ,
17
- authDisabled : cookie . load ( 'db-connector-auth-disabled' )
17
+ /* global PLOTLY_ENV */
18
+ authDisabled : ! PLOTLY_ENV . AUTH_ENABLED
18
19
} ;
19
20
this . toggle = this . toggle . bind ( this ) ;
20
21
this . close = this . close . bind ( this ) ;
Original file line number Diff line number Diff line change @@ -126,7 +126,8 @@ class Login extends Component {
126
126
}
127
127
buildOauthUrl ( ) {
128
128
const { domain} = this . state ;
129
- const oauthClientId = 'isFcew9naom2f1khSiMeAtzuOvHXHuLwhPsM7oPt' ;
129
+ /* global PLOTLY_ENV */
130
+ const oauthClientId = PLOTLY_ENV . OAUTH2_CLIENT_ID ;
130
131
131
132
const redirect_uri = baseUrlWrapped ;
132
133
return (
Original file line number Diff line number Diff line change @@ -200,16 +200,6 @@ export default class Servers {
200
200
Logger . log ( `Listening at: ${ protocol } ://${ domain } :${ port } ` ) ;
201
201
server . listen ( port ) ;
202
202
203
- // Set AUTH_ENABLED into a cookie so that frontend can show login-modal accordingly:
204
- server . use ( ( req , res , next ) => {
205
- const authEnabled = getSetting ( 'AUTH_ENABLED' ) ;
206
- if ( ! authEnabled || that . isElectron ) {
207
- res . setCookie ( 'db-connector-auth-disabled' , true ) ;
208
- }
209
-
210
- next ( ) ;
211
- } ) ;
212
-
213
203
server . get ( / \/ s t a t i c \/ ? .* / , restify . serveStatic ( {
214
204
directory : `${ __dirname } /../`
215
205
} ) ) ;
Original file line number Diff line number Diff line change @@ -2,6 +2,13 @@ import webpack from 'webpack';
2
2
import baseConfig from './webpack.config.base' ;
3
3
import path from 'path' ;
4
4
5
+ const AUTH_ENABLED = process . env . PLOTLY_CONNECTOR_AUTH_ENABLED ?
6
+ JSON . parse ( process . env . PLOTLY_CONNECTOR_AUTH_ENABLED ) : true ;
7
+
8
+ const OAUTH2_CLIENT_ID = process . env . PLOTLY_CONNECTOR_OAUTH2_CLIENT_ID ?
9
+ JSON . stringify ( process . env . PLOTLY_CONNECTOR_OAUTH2_CLIENT_ID ) :
10
+ JSON . stringify ( 'isFcew9naom2f1khSiMeAtzuOvHXHuLwhPsM7oPt' ) ;
11
+
5
12
const config = {
6
13
...baseConfig ,
7
14
@@ -23,6 +30,16 @@ const config = {
23
30
new webpack . DefinePlugin ( {
24
31
__DEV__ : false ,
25
32
'process.env.NODE_ENV' : JSON . stringify ( 'production' )
33
+ } ) ,
34
+
35
+ // This is used to pass environment variables to frontend
36
+ // detailed discussions on this ticket:
37
+ // https://github.com/plotly/streambed/issues/10436
38
+ new webpack . DefinePlugin ( {
39
+ 'PLOTLY_ENV' : {
40
+ 'AUTH_ENABLED' : AUTH_ENABLED ,
41
+ 'OAUTH2_CLIENT_ID' : OAUTH2_CLIENT_ID
42
+ }
26
43
} )
27
44
] ,
28
45
You can’t perform that action at this time.
0 commit comments