Setup the CLI
#
LoginFor 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: https://app.snaplet.dev/access-token/cliโ Paste your access token โฆ xxxx-xxxx-xxxx-xxxxVerifying credentials...โ Logged in as peter@snaplet.dev
#
Select a datasourceThe 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 variablesYou 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.