hrms-admin/src/api/index.ts

67 lines
2.8 KiB
TypeScript
Raw Normal View History

2024-05-29 17:58:57 +07:00
/**config api */
2024-06-06 13:23:23 +07:00
import { ref } from "vue"
2024-05-29 17:58:57 +07:00
2024-06-06 13:23:23 +07:00
const env = ref<string>(process.env.NODE_ENV || "development")
2024-06-07 09:37:58 +07:00
export const apiUrlConfig = import.meta.env.VITE_API_URI_CONFIG
// export const apiUrlConfigPublish = import.meta.env.VITE_API_PUBLISH_URL;
// export const apiUrlConfigReport = import.meta.env.VITE_API_REPORT_URL;
2024-05-29 17:58:57 +07:00
// if (process.env.VUE_APP_TEST) {
// env = "test";
// }
const config = ref<any>({
2024-06-06 13:23:23 +07:00
development: {
2024-07-09 00:04:08 +07:00
API_URI: apiUrlConfig,
API_URI_ORG_SERVICE: apiUrlConfig, //ใช้ชั่วคราว
API_URI_ORG_EMPLOYEE_SERVICE: apiUrlConfig, //ใช้ชั่วคราว
API_URI_PROFILE_SERVICE: apiUrlConfig,
API_REPORT_URI: apiUrlConfig,
2024-06-06 13:23:23 +07:00
MEET_URI: "meet.frappet.com",
API_REPORT2_URI: "https://bma-ehr.frappet.synology.me/api/v2",
API_REPORT_TEMPLATE_URI: "https://report-server.frappet.synology.me/api/v1/report-template",
2024-07-11 10:21:20 +07:00
API_LOG:"http://192.168.1.90:20007/api/v1"
2024-06-06 13:23:23 +07:00
},
test: {
API_URI: "http://localhost:5010/api/v1",
API_CANDIDATE_URI: "https://localhost:7007/api/v1",
API_REPORT_URI: "https://localhost:7007/api/v1",
MEET_URI: "meet.frappet.com",
},
production: {
// API_URI: "https://localhost:5010",
2024-06-07 09:19:22 +07:00
API_URI: apiUrlConfig,
API_URI_ORG_SERVICE: apiUrlConfig, //ใช้ชั่วคราว
API_URI_ORG_EMPLOYEE_SERVICE: apiUrlConfig, //ใช้ชั่วคราว
API_URI_PROFILE_SERVICE: apiUrlConfig,
API_REPORT_URI: apiUrlConfig,
2024-06-06 13:23:23 +07:00
MEET_URI: "meet.frappet.com",
API_REPORT2_URI: `${window.location.protocol}//${window.location.host}/api/v2`,
2024-07-09 00:04:08 +07:00
API_REPORT_TEMPLATE_URI: "https://report-server.frappet.synology.me/api/v1/report-template",
2024-07-11 11:18:04 +07:00
API_LOG:"https://bma-ehr-admin.frappet.synology.me/api/v1"
2024-06-06 13:23:23 +07:00
},
})
2024-05-29 17:58:57 +07:00
2024-06-06 13:23:23 +07:00
const API_URI = ref<string>(config.value[env.value].API_URI)
const API_REPORT_URI = ref<string>(config.value[env.value].API_REPORT_URI)
const API_URI_ORG_SERVICE = ref<string>(config.value[env.value].API_URI_ORG_SERVICE)
const API_URI_ORG_EMPLOYEE_SERVICE = ref<string>(config.value[env.value].API_URI_ORG_EMPLOYEE_SERVICE)
const MEET_URI = ref<string>(config.value[env.value].MEET_URI)
const API_URI_PROFILE_SERVICE = ref<string>(config.value[env.value].API_URI_PROFILE_SERVICE)
const API_REPORT2_URI = ref<string>(config.value[env.value].API_REPORT2_URI)
const API_REPORT_TEMPLATE_URI = ref<string>(config.value[env.value].API_REPORT_TEMPLATE_URI)
2024-07-11 10:21:20 +07:00
const API_LOG = ref<string>(config.value[env.value].API_LOG)
2024-05-29 17:58:57 +07:00
export default {
2024-06-06 13:23:23 +07:00
env: env.value,
config: config.value,
API_URI: API_URI.value,
API_REPORT_URI: API_REPORT_URI.value,
API_URI_ORG_SERVICE: API_URI_ORG_SERVICE.value,
API_URI_ORG_EMPLOYEE_SERVICE: API_URI_ORG_EMPLOYEE_SERVICE.value,
API_URI_PROFILE_SERVICE: API_URI_PROFILE_SERVICE.value,
MEET_URI: MEET_URI.value,
API_REPORT2_URI: API_REPORT2_URI.value,
API_REPORT_TEMPLATE_URI: API_REPORT_TEMPLATE_URI.value,
2024-07-11 10:21:20 +07:00
API_LOG:API_LOG.value
2024-06-06 13:23:23 +07:00
}