Learn how to use Project Templates for automating the creation of environments and secrets for a Project in Doppler with a single-click or CLI command.
Creating a template is easy and straightforward with the complexity and size of the template depending on the number of environments, configs, and variables required.
Don't hard-code secrets in your template file, even if in a private repository.
To get started, create the expected filename
doppler-template.yaml in the root of your repository, then let's take a look at a simple generic example you can use as the basis for your own template:
projects: - name: your-project # Name may contain lowercase letters, spaces, numbers, hyphens, and underscores description: Your project description # List of totally customizable environments, e.g Test, Stage, QA, CI-CD environments: - name: Development # Name may contain letters, spaces, numbers, hyphens, and underscores slug: dev # Slug may contain letters, numbers, hyphens, and underscores configs: - slug: dev # First slug *must* match environment slug name - name: CI-CD slug: ci-cd configs: - slug: ci-cd - slug: ci-cd_github # Branch configs supported - slug: ci-cd_gitlab - name: Test slug: test configs: - slug: test - name: Production slug: prd configs: - slug: prd # Define secrets for each environment secrets: dev: ENV: development API_KEY: "" ci-cd: DOCKER_HUB_USERNAME: "" DOCKER_HUB_TOKEN: "" test: ENV: development API_KEY: "" prd: ENV: production API_KEY: ""
doppler-template.yaml file has been committed to your repository, you're ready to use it by building the import URL for the Doppler dashboard.
Importing a Project Template through the dashboard requires creating an import URL that consists of two parts:
- Doppler import endpoint:
templatequery parameter with the URI encoded URL to your
A fully-formed import URL for a GitHub repository would look similar to the following:
# Subtitute 'YourOrg', 'your-repo' and 'your-branch' https://dashboard.doppler.com/workplace/template/import?template=https%3A%2F%2Fgithub.com%2FYourOrg%2Fyour-repo%2Fblob%2Fyour-branch%2Fdoppler-template.yaml
Opening the URL then triggers the following to occur:
- Ensure the user is signed in or prompt them to create an account
- Confirm which Workplace the project will be created in
- Validate the template
- Create the defined Project, Configs, and Variables
- Navigate to the Project's home page
We recommend using our Import to Doppler button in your
README.md or documentation to use in conjunction with the import URL. Here is an example from our App Config Templates repository:
[![Import to Doppler](https://raw.githubusercontent.com/DopplerUniversity/app-config-templates/main/doppler-button.svg)](https://dashboard.doppler.com/workplace/template/import?template=https%3A%2F%2Fgithub.com%2FDopplerUniversity%2Fapp-config-templates%2Fblob%2Fmain%2Ftemplates%2Fgeneric.yaml)
doppler-template.yaml file has been added to the root of your repository, you can import with a single Doppler CLI command:
Then configure the CLI to use the created project and optionally open the Doppler dashboard to the Project home page:
doppler setup doppler open dashboard
Visit our App Config Templates repository on GitHub for a growing list of example templates.
You can also see how we use Project Templates in our sample applications:
Is there an application you'd like to see an example template for?
You can create an issue or better yet, contribute a template of your own through a Pull Request.
The following code host URLs are supported:
Now you know how to use Doppler Templates to make setting up a new project with one-click or a single command.
Updated 6 months ago