config.ts 776 B

1234567891011121314151617181920212223242526272829303132333435
  1. type env = 'develop' | 'trial' | 'release'
  2. interface ConfigObj {
  3. api: string
  4. webview: string
  5. sokcet: string
  6. upload?: string
  7. }
  8. type ServerConfig = {
  9. [key in env]: ConfigObj
  10. }
  11. const config: ServerConfig = {
  12. develop: {
  13. api: 'https://v4-test.4dkankan.com',
  14. webview: 'https://test.4dkankan.com/livestream',
  15. sokcet: 'wss://testws.4dkankan.com',
  16. },
  17. trial: {
  18. api: 'https://v4-test.4dkankan.com',
  19. webview: 'https://test.4dkankan.com/livestream',
  20. sokcet: 'wss://testws.4dkankan.com',
  21. },
  22. release: {
  23. api: 'https://www.4dkankan.com',
  24. webview: 'https://www.4dkankan.com/livestream',
  25. sokcet: 'wss://ws.4dkankan.com',
  26. }
  27. }
  28. const currentEnv = wx.getAccountInfoSync().miniProgram.envVersion
  29. export const server = config[currentEnv]