Nexus from A to Z, from your first project to a site delivered by your agents
Your progress
0 lesson completed out of 48

A lesson is completed when you tick it, when you watch its video to the end or when you score 80% on its quiz. The certificate is issued online after the final assessment, from a score of 32 out of 40.

Your progress is saved in this browser. Log in to your client area to pick it up on your other devices.

Video transcript

Lesson 9, module 3: The vault and security API keys, the .env and what never gets written down Where should the form's e-mail sending key live?

From the vault to the .env, without a value going through the conversation. [Diagram: From the vault to the .env, with no value shown] 1. The template 2. The status 3. Storing 4. Writing 5. Testing Values go from the vault to the file; the conversation only sees names. The template gives the names. The vault keeps the values. .env.example gets committed, with no values .env never gets committed Nexus refuses to write a .env that isn't ignored One request is enough, and no value is displayed. Request: Prepare the development .env from the vault. First tell me what the template expects and what's missing, without showing any value. Response: Expected: 6 variables. Set from the vault: 4. Missing: EMAIL_API_KEY, SESSION_SECRET. Suggestion: store both in the vault, then regenerate. A secret has only one safe place, and many forbidden ones. [Diagram: Where a secret can be] Green: Its place Orange: Tolerated on the computer Red: Never One safe place, one tolerated place on the computer, and all the others forbidden. Production never comes down to a computer. Development by default Staging on request In development, e-mails are captured A key has leaked: three questions, only one real fix. [Diagram: A key may have leaked] 1. Has the key stayed out of every commit, pushed or not? 2. Is it absent from chats, tickets and screenshots? 3. Does the vault log show no unexpected display? Yes to all: Nothing to revoke. Keep the key, and check that the .env is still ignored by git. In the exercise, you prepare the .env for Sandrine's contact form. Your turn: The .env for Sandrine's form The written course, the corrected exercise and the quiz are below the video.

Lesson 9 of 48 · module 3, the vault and security

API keys, the .env and what is never written down

An API key lives in the vault, never in the code, a commit, a log or the chat. Nexus generates the workstation’s .env from the vault: the agent compares the .env.example template with what the vault can fill in, without displaying any value. The .env must be ignored by git, and production never comes down to a workstation.

  • 25 min of reading
  • 1 min 55 of video
  • 7 diagrams
  • 2 demandes to copy
  • 3 exemples pratiques
  • 4 exercices answerss
  • 5 questions
  • 1 ressource

By the end of this lesson, you will know how to

  • Write a .env.example template and check that git ignores the .env
  • Have the development .env generated from the vault, storing what is missing first
  • Respond to an exposed key by revoking it with the service, then updating the vault

What’s covered

  1. An API key acts on your behalf
  2. The template, and the .env that git ignores
  3. Have the .env generated from the vault
  4. What is never written
  5. Your own Nexus key
  6. 3 worked examples, followed from start to finish
  7. Exercise with answers · The .env for Sandrine’s form
  8. 3 practice exercises, from guided to demanding cases
  9. The quiz

Key points

  • An API key lives in the vault, never in the code, a commit, a log, the browser or the chat.
  • The .env.example gives the names and gets committed; the .env holds the values and git ignores it, otherwise Nexus refuses to write it.
  • A variable goes into the .env if its label in the vault is its name, with the type Environment variable.
  • Production never comes down to a workstation, and in development e-mails are captured.
  • A key written down even once somewhere forbidden is exposed: it is revoked with the service, then replaced in the vault.