Files
2026-07-10 17:08:22 +08:00

50 lines
1.1 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';
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
};
});