Skip to content

Support user-defined configuration in <runMode>.yaml with type-safe access and validation #633

Open

Description

@dufguix

Hello,

Is it possible to use development.yaml, production.yaml, staging.yaml to add custom config ?
I see it's possible for passwords.yaml.

I think about smtp config for now.

Have a good day.

Activity

  1. added
    enhancement
    on Feb 9, 2023
  2. vlidholt commented on Feb 9, 2023

    @vlidholt
    Collaborator

    That would be a nice addition! I guess it's technically possible to use the passwords file for this until this feature is implemented.

  3. dufguix commented on Feb 10, 2023

    @dufguix
    Author

    Yes for sure. I'll create a passwords.yaml template without passwords to be able to git push.

  4. vlidholt commented on Feb 10, 2023

    @vlidholt
    Collaborator

    An option is also to do the configuration in code, rather than having it in a config file. Or just load a different config file depending on you run mode. You can access the run mode from Serverpod.instance!.runmode. It can be set to one of: ServerpodRunMode.development, ServerpodRunMode.staging, or ServerpodRunMode.production.

  5. dufguix commented on Feb 10, 2023

    @dufguix
    Author

    Thanks. Good to know Serverpod.instance!.runmode.

  6. egyleader commented on May 3, 2023

    @egyleader

    I can see this is already implemented in serverpod 1.1.0 , I think this issue should be closed
    image

  7. migalv commented on Nov 28, 2024

    @migalv

    It seems it's not yet implemented if I'm not mistaken. I think this would be very cool to have.

  8. added
    area: configuration
    on Dec 17, 2024
  9. SandPod commented on Jun 4, 2025

    @SandPod
    Contributor

    I will update the title of this issue to cover some additional requirements.

    Description

    To support advanced use cases and plugins, it should be possible for developers to extend the <runMode>.yaml configuration file with their own custom configuration options. These custom configurations should integrate seamlessly with Serverpod’s existing configuration system.

    Requirements

    • Developers should be able to register additional configuration fields under custom namespaces.
    • It must be possible to specify validation rules and metadata for each configuration field:
      • Whether the field is required or optional.
      • Default values for optional fields.
    • Serverpod should produce a typed configuration object for the custom configuration:
      • This type can either be supplied by the user at registration or generated by Serverpod.
    • The resolution order for custom configuration values must match the standard Serverpod configuration system:
      • Values from environment variables should override values from the configuration file (<runMode>.yaml).
    • Clear error messages when required fields are missing or have invalid types.
  10. changed the title [-]Custom fields in config files ?[/-] [+]Support user-defined configuration in `<runMode>.yaml` with type-safe access and validation[/+] on Jun 4, 2025
  11. removed
    good first issue
    on Jun 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: configurationenhancement

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions