pi-kiosk-shared 1.0.20 → 1.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/environments.js +23 -5
- package/package.json +1 -1
|
@@ -84,6 +84,13 @@ export const getCurrentEnvironment = () => {
|
|
|
84
84
|
if (typeof process !== 'undefined' && process.env) {
|
|
85
85
|
return process.env.NODE_ENV === 'production' ? 'production' : 'development';
|
|
86
86
|
}
|
|
87
|
+
// Check if we're on Railway domain (most reliable for production detection)
|
|
88
|
+
if (typeof window !== 'undefined' && window.location) {
|
|
89
|
+
if (window.location.hostname.includes('railway.app') ||
|
|
90
|
+
window.location.hostname.includes('up.railway.app')) {
|
|
91
|
+
return 'production';
|
|
92
|
+
}
|
|
93
|
+
}
|
|
87
94
|
// Check for import.meta.env (Vite environment)
|
|
88
95
|
if (typeof window !== 'undefined') {
|
|
89
96
|
try {
|
|
@@ -94,13 +101,24 @@ export const getCurrentEnvironment = () => {
|
|
|
94
101
|
}
|
|
95
102
|
}
|
|
96
103
|
catch (e) {
|
|
97
|
-
//
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
104
|
+
// Ignore errors
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// Additional fallback: check for production URLs in environment variables
|
|
108
|
+
if (typeof window !== 'undefined') {
|
|
109
|
+
try {
|
|
110
|
+
// @ts-ignore - Vite environment
|
|
111
|
+
const meta = globalThis.import?.meta;
|
|
112
|
+
if (meta && meta.env) {
|
|
113
|
+
const apiUrl = meta.env.VITE_API_URL || meta.env.REACT_APP_API_URL;
|
|
114
|
+
if (apiUrl && apiUrl.includes('railway.app')) {
|
|
115
|
+
return 'production';
|
|
116
|
+
}
|
|
102
117
|
}
|
|
103
118
|
}
|
|
119
|
+
catch (e) {
|
|
120
|
+
// Ignore errors
|
|
121
|
+
}
|
|
104
122
|
}
|
|
105
123
|
return 'development';
|
|
106
124
|
};
|