|
|
@ -1,7 +1,7 @@
|
|
|
|
import { Writer } from 'clitastic'
|
|
|
|
import { Writer } from 'clitastic'
|
|
|
|
|
|
|
|
|
|
|
|
import { config, VERBOSE } from './autorestic'
|
|
|
|
import { config, VERBOSE } from './autorestic'
|
|
|
|
import { Backend, Backends } from './types'
|
|
|
|
import { Backend, Backends, Locations } from './types'
|
|
|
|
import { exec, ConfigError } from './utils'
|
|
|
|
import { exec, ConfigError } from './utils'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -34,6 +34,13 @@ export const getEnvFromBackend = (backend: Backend) => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const getBackendsFromLocations = (locations: Locations): string[] => {
|
|
|
|
|
|
|
|
const backends = new Set<string>()
|
|
|
|
|
|
|
|
for (const to of Object.values(locations).map(location => location.to))
|
|
|
|
|
|
|
|
Array.isArray(to) ? to.forEach(t => backends.add(t)) : backends.add(to)
|
|
|
|
|
|
|
|
return Array.from(backends)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export const checkAndConfigureBackend = (name: string, backend: Backend) => {
|
|
|
|
export const checkAndConfigureBackend = (name: string, backend: Backend) => {
|
|
|
|
const writer = new Writer(name.blue + ' : ' + 'Configuring... ⏳')
|
|
|
|
const writer = new Writer(name.blue + ' : ' + 'Configuring... ⏳')
|
|
|
|
const env = getEnvFromBackend(backend)
|
|
|
|
const env = getEnvFromBackend(backend)
|
|
|
|