Files
2026-07-11 21:36:26 +08:00

50 lines
1.2 KiB
JavaScript

(function (root, factory) {
// 根配置只负责运行环境与接口基础地址。
if (typeof module === 'object' && module.exports) {
module.exports = factory;
return;
}
root.GenealogyConfig = factory(root);
})(typeof globalThis !== 'undefined' ? globalThis : window, function (root) {
'use strict';
// 这里只维护运行环境和后端基础地址,具体接口路径统一放在 ApiClient 中。
var ENVIRONMENTS = {
development: {
apiBaseUrl: 'http://182.61.18.23:8080'
},
production: {
apiBaseUrl: 'http://182.61.18.23:8080'
}
};
function getEnvironment() {
var location = root.location || {};
var hostname = location.hostname || '';
if (hostname === 'localhost' || hostname === '127.0.0.1' || location.port) {
return 'development';
}
return 'production';
}
function getApiBaseUrl() {
return ENVIRONMENTS[getEnvironment()].apiBaseUrl;
}
function getConfig() {
return {
environment: getEnvironment(),
apiBaseUrl: getApiBaseUrl()
};
}
return {
getEnvironment: getEnvironment,
getApiBaseUrl: getApiBaseUrl,
getConfig: getConfig
};
});