8000 [FEATURE] Per-note/dir/block environments · Issue #412 · twibiral/obsidian-execute-code · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
[FEATURE] Per-note/dir/block environments #412
Open
@jbschooley

Description

@jbschooley

Is your feature request related to a problem? Please describe.
I'd like to be able to specify an environment for a language inside a directory or individual note. Any code in that language inside that note would use that environment, but notes outside of that would either use their own environments or the default environment.

Describe the solution you'd like
Something that allows me to define an environment for that individual note or any notes in the current directory and its children. For example with SQL, I could define a server to connect to (possibly pulling credentials from a .env file that may or may not be in the current dir or even in the vault) and any SQL blocks in that note or dir would connect to that host.

Maybe even an option to specify it per code block:

```sql {env='prod'}

or in a file

```sql {env='./prod.env'}
```sql {env='~/envs/prod.env'}

prod.env:

path: psql
# path: docker run -it --rm postgres psql
args: -d <database> -U <user> -f

Maybe something like {pre, env='~/really/long/path/prod.env'} to apply that env to everything in the note. Or {label='prod', env='~/really/long/path/prod.env'} and use an import to reuse that env without having to rewrite the path for each block.

Or even {env=[dev='./dev.env', prod='./prod.env']} and the Run button in that block (and anything that imports it) would change to 2 buttons labeled dev and prod

Describe alternatives you've considered
Right now I don't know of anything like this. I just copy-paste my code into terminal in a dir where I use direnv to set up environments

Additional context
I'm looking for a place to keep all my snippets for all my projects and be able to easily run them. I think this is the last piece of the puzzle.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0