Skip to content

Commit

Permalink
add cli sync docs (#748)
Browse files Browse the repository at this point in the history
  • Loading branch information
alishakawaguchi authored Dec 5, 2023
1 parent ee0ff9b commit 4d2465b
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 3 deletions.
10 changes: 7 additions & 3 deletions docs/docs/cli/introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Available Commands:
help Help about any command
jobs Parent command for jobs
login Login to Neosync
sync One off sync job to local resourc
version Print the client version information
whoami Find out who you are

Expand All @@ -42,12 +43,15 @@ Use "neosync [command] --help" for more information about a command.
There are a few global environment variables that are available on every request.

### `NEOSYNC_API_KEY`

Neosync API Key. Used if logging in via a system api key.

### `NEOSYNC_API_URL`

The url of the Neosync API to direct the request to.

### Full list

For a full list of environment variables and flags available, see the specific command you are running.
Otherwise, there is a top-level list of all environment variables spread across all commands available [here](../deploy/environment-variables.mdx#cli).

Expand All @@ -58,6 +62,6 @@ This lets the API know which version the CLI is using when it invokes commands t

The following metadata is added to all CLI context:

* Git Version
* Git Commit
* OS Platform
- Git Version
- Git Commit
- OS Platform
42 changes: 42 additions & 0 deletions docs/docs/cli/sync.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
title: sync
id: sync
hide_title: true
slug: /cli/sync
---

import { DocPageHeader } from '@site/src/CustomComponents/DocPageHeader.tsx';

<DocPageHeader title="neosync sync" />

## Overview

Learn how to sync data to a local destination with the neosync sync CLI command.

The `neosync sync` command is used to sync data from a neosync connection to a local destination.
Supported sources and destinations are currently postgres and mysql.

## Usage

```bash
neosync sync
```

## Options

The following options can be passed using the `neosync sync` command:

- `--api-key` - Neosync API Key. Takes precedence over `$NEOSYNC_API_KEY`
- `--config` - Path to yaml config. Defaults to `neosync.yaml` in current directory.
- `--connection-id` - Neosync connection id for sync data source. Takes precedence over config.
- `--destination-connection-url` - Local destination connection url to sync data to. Takes precedence over config.
- `--destination-driver` - Destination connection driver (postgres, mysql). Takes precendence over config.

## Yaml Config File

```yaml
connection-id: d9dc020d-746b-48c1-9319-a165a25ac32e
destination:
connection-url: user:pass@tcp(127.0.0.1:3306)/database
driver: mysql
```
5 changes: 5 additions & 0 deletions docs/sidebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ const sidebars: SidebarsConfig = {
id: 'cli/version',
label: 'version',
},
{
type: 'doc',
id: 'cli/sync',
label: 'sync',
},
],
},
{
Expand Down
4 changes: 4 additions & 0 deletions docs/src/CustomComponents/IconHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { AiOutlineMail, AiOutlinePhone } from 'react-icons/ai';
import { BiLogInCircle, BiLogoPostgresql, BiTerminal } from 'react-icons/bi';
import { BsFunnel, BsShieldCheck } from 'react-icons/bs';
import { FaAws, FaDocker } from 'react-icons/fa';
import { GoSync } from 'react-icons/go';

import { GoCode, GoTable, GoVersions } from 'react-icons/go';
import { GrMysql } from 'react-icons/gr';
import { IoBuildOutline } from 'react-icons/io5';
Expand Down Expand Up @@ -79,6 +81,8 @@ export function IconHandler(name: string): ReactElement {
return <MdStart />;
case 'version':
return <GoVersions />;
case 'sync':
return <GoSync />;
default:
return <LayersIcon />;
}
Expand Down

0 comments on commit 4d2465b

Please sign in to comment.