Skip to main content

Setup the CLI


For local development use snaplet login to associate your machine to your Snaplet account. You only need to do this once per machine, the access-token is stored in ~/.snaplet/config.json. You can also set the SNAPLET_ACCESS_TOKEN env-var.

$ snaplet loginGet your personal access token from this page:โœ” Paste your access token โ€ฆ xxxx-xxxx-xxxx-xxxxVerifying credentials...โœ” Logged in as

Select a datasource#

The CLI is installed and logged in, there's one final step before you can restore a snapshot, which is to associate your code's repository to the datasource you created in the first step.

Access to snapshots are scoped to a specific directory on your filesystem as this allows you to restore from multiple datasources on a single machine.

The snaplet setup command can be run for each repo, this is usually run at the repository root directory level, where a configuration file (<projectRepo>/.snaplet/config.json) is generated.

# Change to your project's directorycd ./your/code
$ snaplet setupโœ” Restore snapshots from... โ€บ SnapletTesting connection credentials... โœ” SuccessConnection credentials:user       postgreshost       localhostport       5432userpassword   database   snaplet_developmentWrote project config

Environmental variables#

You can overwrite the configuration:

  • SNAPLET_ACCESS_TOKEN=xxx-xxx-xxx: Overwrite the access token, logging in with a different user.
  • SNAPLET_DATABASE_ID=xxx-xxx-xxx: Overwrite the current datasource.
  • SNAPLET_DATABASE_CONNECTION_STRING=pg://user:pasword@localhost:5432/database: Database connection credentials.