.livingdocs-cli

Set up a cli dotfile

In case you are working with multiple projects and/or environments it becomes cumbersome to set tokens, hosts and other params.
To make the sync projects process easier you can set up a dotfile that allows you to pass env and project to all commands where this makes sense instead of using e.g. the LI_TOKEN environment variable.

Multiple environments

.livingdocs-cli file in the root of your working directory:
1
{
2
"environments": {
3
"local": {
4
"host": "https://localhost:9000",
5
"token": "local-token",
6
"distFolder": "./config-sync/local"
7
},
8
"development": {
9
"host": "https://server-development.example.dev",
10
"token": "dev-token",
11
"distFolder": "./config-sync/development"
12
},
13
"staging": {
14
"host": "https://server-staging.example.dev",
15
"token": "staging-token",
16
"distFolder": "./config-sync/staging"
17
},
18
"production": {
19
"host": "https://server-production.example.dev",
20
"token": "production-Token",
21
"distFolder": "./config-sync/production"
22
}
23
},
24
"alias": {
25
"dev": "development"
26
}
27
}
Copied!
Note: it is recommended to add a production token with only read access. When publishing a new config you can supply a write token via --token argument.
How to use these configs in the terminal:
1
# with `env` param
2
npx livingdocs-cli project-config:download --env development
3
​
4
# in shorthand form
5
npx livingdocs-cli project-config:download -e development
6
​
7
# in shorthand form and also using an alias
8
npx livingdocs-cli project-config:download -e dev
Copied!

Multiple projects & environments

.livingdocs-cli file in the root of your working directory:
1
{
2
"projects": {
3
"projectA": {
4
"environments": {
5
"development": {
6
"host": "https://server-development.exampleA.dev",
7
"token": "dev-token",
8
"distFolder": "./sync-projectA/development"
9
},
10
"production": {
11
"host": "https://server-production.exampleA.dev",
12
"token": "production-Token",
13
"distFolder": "./sync-projectA/production"
14
}
15
}
16
},
17
"projectB": {
18
"environments": {
19
"development": {
20
"host": "https://server-development.exampleB.dev",
21
"token": "dev-token",
22
"distFolder": "./sync-projectB/development"
23
},
24
"production": {
25
"host": "https://server-production.exampleB.dev",
26
"token": "production-Token",
27
"distFolder": "./sync-projectB/production"
28
}
29
}
30
}
31
},
32
​
33
"alias": {
34
"dev": "development"
35
}
36
}
Copied!
How to use these configs in the terminal:
1
# # with `project` and `env` params
2
npx livingdocs-cli project-config:download --project projectA --env development
3
​
4
# in shorthand form
5
npx livingdocs-cli project-config:download -p projectA -e development
6
​
7
# in shorthand form and using an alias
8
npx livingdocs-cli project-config:download -p projectA -e dev
Copied!
Last modified 1yr ago