question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Would be amazing if this could configure enviroment variables as well

See original GitHub issue

Issue Type

  • Bug Report
  • Feature Request
  • Other

Possible Solutions

scripts:
  # "denox run start" will execute main.ts with example.com networking permissions
  start:
    file: main.ts
    env:
      PORT: 80
      DOMAIN: "example.net"
    deno_options:
      allow-net: example.com
  # "denox run develop" will execute main.ts with localhost networking permissions and source code cache reloaded
  develop:
    file: main.ts
    env:
      PORT: 3000
      DOMAIN: "localhost"
    deno_options:
      allow-net: localhost
      reload: true

Then it would add the variables to Deno using Deno.env.set(‘NAME’, ‘VALUE’) Then we can access it via Deno.env.get(“NAME”)

It would require --allow-env to be set.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
wattrycommented, Jun 15, 2020

Yeah, that was my thought. — Zane Milakovic On Jun 15, 2020, 10:56 AM -0500, Ryan @.***>, wrote: Which module will you be using for the environment variable file read? I’m assuming dotenv? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

It was always the defacto package I would turn to. I’d like to see support for inline scripts in denox and env variable support would be an important component.

1reaction
khrome83commented, May 20, 2020

I am fine with the last one.

I can also see something like this -

scripts:
  start:
    file: main.ts
    env: 
      file: ./.env
      vars:
        PORT: 80
        DOMAIN: "example.net"

I think this should also allow the global layer, like you do with permissions.

Optionally, would you use a file and the vars at the same time? In other words if the YAML parsed as a string vs a object, you could handle it different.

Parse as a object, no need for a file

scripts:
  start:
    file: main.ts
    env: 
      PORT: 80
      DOMAIN: "example.net"

Parses as a string, going to disk

scripts:
  start:
    file: main.ts
    env: ./.env
Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Set Environment Variables
Environment variables in your system describe your environment. Learn how to set up environment variables in Linux, Windows, macOS, ...
Read more >
Environment Variables and Why You Shouldn't Use Them
Using environment variables is a somewhat common practice during Development but it is actually not a healthy practice to use with Production.
Read more >
3 benefits of environment variables and how to use them
With environment variables, you can just create a single config and tweak it based on the values you define.
Read more >
Environment Variables: What They Are and How To Use ...
Environment variables are used to store app secrets and configuration data, which are retrieved by your running app when needed.
Read more >
what you should know about ENV configuration
An exploration of the usage and limitations of ENV (environment variables) in configurations.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found