← Back to Changelog

21st December 2020

Project Secrets

Environment variables provide a secure way to store your keys, tokens, paths and other secrets used in your applications. They can be added for services and jobs under the Environment tab.

Projects are groups of services, jobs and addons. With Project Secrets, you can now set environment variables on a project level which will save time and ease variable management if several of your applications depend on the same values.

  • Apply Project Secrets to the whole project or restrict to one or more services & jobs
  • Create more Project Secrets and set priorities to define which ones take precedence
  • Setting variables directly in the service or job will always have priority over Project Secrets

Secrets are encrypted at rest and only decrypted before being merged and injected into your runtime environment.

To create your Project Secrets, navigate to your project and select Secrets from the Dashboard or Sidebar.

Project Secrets are also fully supported via the Northflank API & CLI (introduced in this article) with team RBAC included.

Here is an example of creating Project Secrets using the Northflank API:

const payload = {
  name: 'My Project Secret',
  description: 'Environment variables for my project',
  secretType: 'environment',
  priority: 10,
  restrictions: {
    restricted: false,
    nfObjects: [
      {}
    ]
  },
  data: {
    API_KEY: '****',
    API_TOKEN: '****'
  }
}

const response = await fetch(NORTHFLANK_API_ENDPOINT, {
  method: 'POST',
  headers: {
  	'Accept': 'application/json',
  	'Content-Type': 'application/json',
  	'Authorization': `Bearer ${NORTHFLANK_API_TOKEN}`,
},
  body: JSON.stringify(payload),
});

const json = await response.json()
console.log(json)

// => Created secret My Project Secret

Share this article with your network