@@ -30,15 +30,48 @@ Application.prototype.setupJavaScriptArguments = function() {
30
30
app . commandLine . appendSwitch ( 'js-flags' , '--harmony' ) ;
31
31
} ;
32
32
33
+ /**
34
+ * Map package.json product names to API endpoint product names.
35
+ */
36
+ const API_PRODUCT = {
37
+ 'mongodb-compass' : 'compass' ,
38
+ 'mongodb-compass-community' : 'compass-community'
39
+ } ;
40
+
41
+ /**
42
+ * Platform API mappings.
43
+ */
44
+ const API_PLATFORM = {
45
+ 'darwin' : 'osx' ,
46
+ 'win32' : 'windows' ,
47
+ 'linux' : 'linux'
48
+ } ;
49
+
50
+ /**
51
+ * Get the channel name from the version number.
52
+ *
53
+ * @returns {String } - The channel.
54
+ */
55
+ const getChannel = ( ) => {
56
+ if ( pkg . version . indexOf ( 'beta' ) > - 1 ) {
57
+ return 'beta' ;
58
+ }
59
+ return 'stable' ;
60
+ } ;
61
+
62
+ /**
63
+ * TODO (imlucas) Extract .pngs from .icns so we can
64
+ * have nice Compass icons in dialogs.
65
+ *
66
+ * path.join(__dirname, '..', 'resources', 'mongodb-compass.png')
67
+ */
33
68
Application . prototype . setupAutoUpdate = function ( ) {
34
69
this . autoUpdateManager = new AutoUpdateManager (
35
- _ . get ( pkg , 'config.hadron.endpoint' )
36
- /**
37
- * TODO (imlucas) Extract .pngs from .icns so we can
38
- * have nice Compass icons in dialogs.
39
- *
40
- * path.join(__dirname, '..', 'resources', 'mongodb-compass.png')
41
- */
70
+ _ . get ( pkg , 'config.hadron.endpoint' ) ,
71
+ null ,
72
+ API_PRODUCT [ process . env . HADRON_PRODUCT ] ,
73
+ getChannel ( ) ,
74
+ API_PLATFORM [ process . platform ]
42
75
) ;
43
76
44
77
this . autoUpdateManager . on ( 'state-change' , function ( newState ) {
0 commit comments