MCPcopy Create free account
hub / github.com/deta/surf / getConfig

Method getConfig

packages/services/src/lib/sync.ts:37–60  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35 }
36
37 private getConfig() {
38 const userSettings = get(this.userConfig.settings)
39
40 const envToken = import.meta.env.R_VITE_SYNC_AUTH_TOKEN
41 const envBaseUrl = import.meta.env.R_VITE_SYNC_BASE_URL
42
43 if (envToken && envBaseUrl) {
44 this.log.debug('using env config')
45 return {
46 baseUrl: envBaseUrl,
47 authToken: envToken
48 }
49 }
50
51 if (userSettings.sync_base_url && userSettings.sync_auth_token) {
52 this.log.debug('using user config')
53 return {
54 baseUrl: userSettings.sync_base_url,
55 authToken: userSettings.sync_auth_token
56 }
57 }
58
59 return null
60 }
61
62 private async fetch<T>(path: string, options: RequestInit = {}): Promise<T> {
63 const config = this.getConfig()

Callers 3

fetchMethod · 0.95
syncMethod · 0.95
createDemoNotebookFunction · 0.45

Calls 2

getFunction · 0.85
debugMethod · 0.80

Tested by

no test coverage detected