mirror of
https://github.com/cupcakearmy/autorestic.git
synced 2024-12-22 16:26:25 +00:00
method to get all the backends from a list of locations
This commit is contained in:
parent
cdf18430b6
commit
88059fe405
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user