Skip to content

Substitute contents of a file as json object in config #1658

Closed

Description

@drybalka

In the config docs it is said that I may use {file:...} syntax to substitute the contents of the file, which is useful for "Sharing common configuration snippets across multiple config files.". This sounds to me like I may share more than literal strings with this functionality. In particular, I would like to be able to import the whole json object for my providers, like "provider": "{file:providers.json}" or something like that. However, I could not make it work as I always get the "wrong type" error for "provider" field. Is this at all possible and if yes how? Is this a feature you may add?

Activity

  1. self-assigned this
    on Aug 7, 2025
  2. thdxr commented on Aug 7, 2025

    @thdxr
    Member

    this is an interesting problem but i don't think we can support it - ultimately this only works on stringy fields and the feature was intended to deal with passing around large strings or environment variable strings

    if you put opencode.json in a parent directory it will find it and merge but not sure if that's viable for your situation

  3. rekram1-node commented on Dec 28, 2025

    @rekram1-node
    Contributor

    [automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions