autorestic/src/types.ts

98 lines
1.5 KiB
TypeScript
Raw Normal View History

2019-12-05 00:23:15 +01:00
export type StringOrArray = string | string[]
// BACKENDS
2019-06-20 23:09:47 +02:00
type BackendLocal = {
2020-11-06 23:51:23 +01:00
type: 'local'
key: string
path: string
2019-06-20 23:09:47 +02:00
}
type BackendSFTP = {
2020-11-06 23:51:23 +01:00
type: 'sftp'
key: string
path: string
password?: string
2019-06-20 23:09:47 +02:00
}
type BackendREST = {
2020-11-06 23:51:23 +01:00
type: 'rest'
key: string
path: string
user?: string
password?: string
2019-06-20 23:09:47 +02:00
}
type BackendS3 = {
2020-11-06 23:51:23 +01:00
type: 's3'
key: string
path: string
aws_access_key_id: string
aws_secret_access_key: string
2019-06-20 23:09:47 +02:00
}
type BackendB2 = {
2020-11-06 23:51:23 +01:00
type: 'b2'
key: string
path: string
b2_account_id: string
b2_account_key: string
2019-06-20 23:09:47 +02:00
}
type BackendAzure = {
2020-11-06 23:51:23 +01:00
type: 'azure'
key: string
path: string
azure_account_name: string
azure_account_key: string
2019-06-20 23:09:47 +02:00
}
type BackendGS = {
2020-11-06 23:51:23 +01:00
type: 'gs'
key: string
path: string
google_project_id: string
google_application_credentials: string
2019-06-20 23:09:47 +02:00
}
2020-11-06 23:51:23 +01:00
export type Backend = BackendAzure | BackendB2 | BackendGS | BackendLocal | BackendREST | BackendS3 | BackendSFTP
2019-06-20 23:09:47 +02:00
export type Backends = { [name: string]: Backend }
2019-12-05 00:23:15 +01:00
// LOCATIONS
2019-06-20 23:09:47 +02:00
export type Location = {
2020-11-06 23:51:23 +01:00
from: string
to: StringOrArray
cron?: string
hooks?: {
before?: StringOrArray
after?: StringOrArray
}
options?: {
[key: string]: {
[key: string]: StringOrArray
}
}
2019-06-20 23:09:47 +02:00
}
export type Locations = { [name: string]: Location }
2019-12-05 00:23:15 +01:00
// OTHER
2019-06-20 23:09:47 +02:00
export type Config = {
2020-11-06 23:51:23 +01:00
locations: Locations
backends: Backends
2019-06-20 23:09:47 +02:00
}
2020-05-17 11:13:02 +02:00
export type Lockfile = {
2020-11-06 23:51:23 +01:00
running: boolean
crons: {
[name: string]: {
lastRun: number
}
}
2020-05-17 11:13:02 +02:00
}
export type Flags = { [arg: string]: any }