Skip to content

Using secrets

A "secret" in Miget refers to sensitive information, such as API keys, database credentials, or other configuration values that should be kept secure and not exposed in your application's codebase. Managing secrets properly ensures that your application can operate securely, without risking unauthorized access to critical data.

By understanding and managing secrets effectively, you can ensure that your Miget applications remain secure and flexible, allowing you to focus on building and deploying your app with confidence.

Why Use Secrets?

Secrets are used to protect sensitive information and provide a safe way to manage configuration data that should not be hard-coded into your application. By using secrets, you can:

  • Secure Sensitive Data: Keep important credentials and keys out of your source code.

  • Easily Update Configurations: Modify configuration values without changing the code.

  • Manage Environments: Set different values for development, staging, and production environments.

Config Vars for Build and Run Phases

Miget allows you to set configuration variables for both the Build phase and the Run phase.

  • Build Phase: These variables are used during the building of your application, which might include compiling assets, installing dependencies, or configuring services that your app will use.
  • Run Phase: These variables are used when your application is running, controlling things like database connections, third-party service credentials, and more. You can manage these configurations in the same "Config Vars" section within the Settings tab, ensuring that your application behaves correctly across different stages of its lifecycle.

Addon Variables

When you add an addon to your Miget application, it often comes with pre-configured environment variables. These variables are automatically set by Miget, simplifying the process of connecting your app to the addon.

For example, when you add a PostgreSQL addon, Miget will automatically generate and set a DATABASE_URL variable with a value like postgres://fcsn1vo8:PXERTRrlRhTb@postgres-t7hvtfin.migetyem.svc:5432/t7hvtfin. This means you don’t have to manually configure your database connection—Miget handles it for you, ensuring the connection details are securely stored and easily accessible by your application during runtime.