(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://test-genealogy-api.ddxcjp.cn' }, production: { // 后端尚未提供正式生产域名,暂时保持用户指定的测试地址。 apiBaseUrl: 'http://test-genealogy-api.ddxcjp.cn' } }; 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 }; });