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 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 email@example.com
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.
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
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.