Local Development: Java & Kotlin
Put ennote secret get "<secret>" -- in front of the Maven or Gradle command that starts your app. The JVM sees the values as environment variables.
The examples use a secret named api-env. Set your organization and workspace once with ennote config set, or add --organization-id and --workspace-id flags as in the overview.
Running Spring Boot
With Maven:
ennote secret get "api-env" -- ./mvnw spring-boot:run
With Gradle:
ennote secret get "api-env" -- ./gradlew bootRun
Mapping Keys to Spring Properties
Spring Boot maps environment variables to properties automatically (relaxed binding): uppercase the property name, replace dots with underscores and remove dashes. Name the keys of your Ennote secret accordingly:
| Key in Ennote | Spring property |
|---|---|
SPRING_DATASOURCE_URL | spring.datasource.url |
SPRING_DATASOURCE_USERNAME | spring.datasource.username |
SPRING_DATASOURCE_PASSWORD | spring.datasource.password |
STRIPE_SECRETKEY | stripe.secret-key |
No passwords are needed in application.properties or application.yml. You can also reference a variable by name with a placeholder:
payment:
api-key: ${PAYMENT_API_KEY}
Plain Java and Kotlin
Read any key with System.getenv:
String databaseUrl = System.getenv("DATABASE_URL");
val databaseUrl = System.getenv("DATABASE_URL")
Running From IntelliJ IDEA
A regular Spring Boot or Application run configuration starts the JVM directly, not through Ennote, so the variables are missing. Instead, create a Shell Script run configuration that starts Maven through Ennote, and start the app with the usual Run button.
Add a Shell Script run configuration
Open Run -> Edit Configurations, click + and choose Shell Script. Give it a name, for example Spring Boot (Ennote).
Enter the script
Set Execute to Script text and paste:
[ -f ~/.profile ] && source ~/.profile
[ -f ~/.bashrc ] && source ~/.bashrc
ennote secret get "api-env" --organization-id "my-org-id" --workspace-id "local-development" -- ./mvnw spring-boot:run
Set Interpreter path to /bin/bash and Working directory to your project root.
Run it
Select the configuration and click Run. The app's output appears in the Run tool window.
Why the script loads ~/.profile and ~/.bashrc: an IDE started from the desktop, the dock or JetBrains Toolbox does not load your shell profile, so the folder where ennote is installed may not be on its PATH. Loading the profile first gives the script the same PATH as your terminal. On macOS with zsh, use /bin/zsh as the interpreter and load ~/.zprofile and ~/.zshrc instead.
If your project has no Maven wrapper (mvnw), use the Maven bundled with IntelliJ IDEA instead of ./mvnw. Find its folder in Settings -> Build, Execution, Deployment -> Build Tools -> Maven -> Maven home path, and use <that folder>/bin/mvn, for example:
ennote secret get "api-env" -- ~/.local/share/JetBrains/Toolbox/apps/intellij-idea-ultimate/plugins/maven-plugin/lib/maven3/bin/mvn spring-boot:run
The path depends on your operating system and how IntelliJ IDEA was installed. For Gradle projects, replace the Maven command with ./gradlew bootRun.
ennote auth login, stored in your OS keyring, so the run configuration needs no token. If the run fails with an authentication error, run ennote auth login in a terminal and try again.Need Help?
If you encounter any issues or have questions, don't hesitate to contact support. Our team is here to assist you with any challenges you might face.
Go
Run Go services locally with secrets from Ennote instead of a .env file: start go run, Air live reload or tests with ennote secret get and read the values with os.Getenv.
PHP
Run Laravel, Symfony and plain PHP apps locally with secrets from Ennote instead of a .env file, by starting php artisan serve, the PHP built-in server or Composer scripts with ennote secret get.