Secrets · Getting started
Quickstart
From a new project to a server with its .env in five steps. You need a machine with bash and curl for the last two.
1. Add Secrets to a project
At id.my-beast.com, pick Secrets and a package, name your project and pay. The project starts with three environments: development, staging and production.
Then open it: on the project's page at id, Secrets' name opens the project in Secrets. Its tabs are Overview, Variables and Tokens.
2. Add your variables
Open Variables, then development. The quickest way in is the .env your app already has: choose Import a .env and paste it.
APP_NAME="My Shop"
APP_URL=https://shop.example.com
DB_HOST=127.0.0.1
DB_PASSWORD=change-me
STRIPE_SECRET=sk_test_…Check shows what each line would do (Adds, Changes, Same already or Skipped, and why) before anything changes. Each new name is Secret unless you tick Visible; an address or a host is ticked for you. Then Import 5 into development: the lines arrive as one numbered change in the environment's history.
You can add a variable at a time instead, with Add a variable. Names are UPPER_SNAKE: Names and values has the rules.
3. Make a service token
Open Tokens and choose Make a token. Pick the environment it reads, development, and give it a label that says where it runs, such as laptop. Making a token takes Admin in the project.
The next page shows the token once, in the two lines a machine needs:
export MYBEAST_SECRETS_URL=https://services.my-beast.com/secrets
export MYBEAST_SECRETS_TOKEN=st_….…Copy it now
4. Install the CLI
mybeast-secrets is one file from the latest release of my-beast/cli on GitHub. Put it in a folder on your PATH:
curl -fsSLo ~/.local/bin/mybeast-secrets https://github.com/my-beast/cli/releases/latest/download/mybeast-secrets
chmod +x ~/.local/bin/mybeast-secrets
mybeast-secrets --versionCLI shows how to check the download against the release's checksums.
5. Pull the variables
In the shell, set the two lines from step 3. Then print the environment without writing anything, to check:
mybeast-secrets pull --out -The first line names the project and the environment, such as # MyBeast Secrets · shop/development · change #1 · 5 variables · …, then come the variables. When that looks right, write the file in the app's folder:
mybeast-secrets pullIt writes .env, readable by its owner only. To start the app with the variables and write nothing to disk, use run instead:
mybeast-secrets run -- php artisan serveOn the Tokens page, the token now says Up to date. The read is in the project's audit log.
Next steps
- Pull variables on a server: CI, deploys, and when to use
pullorrun. - Compare environments: fill
stagingandproductionand see what each lacks. - Control who sees values: keep production to the people who need it.
- CLI reference: every command, flag and message.