npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ember-runtime-env

v0.0.2

Published

The default blueprint for ember-cli addons.

Readme

ember-runtime-env

ember-runtime-env allows making environment variables from the host's context available at runtime.

This add-on is particularly useful for deployment pipelines like Heroku, where environment variables may change between environments. With ember-runtime-env, there's no need to rebuild the application when moving it into a new environment. Instead, the environment variables from the host's context are made available at runtime, allowing for a more efficient and flexible deployment process.

Compatibility

  • Ember.js v4.8 or above
  • Ember CLI v4.8 or above
  • Node.js v18 or above

Requirements

This add-on requires the application to be running within Fastboot

Installation

ember install ember-runtime-env

pass environment variables into fastboot scope

// config/fastboot.js
const dotenv = require("dotenv");
dotenv.config();

const processEnvVars = require("ember-runtime-env");

const envVars = ["PORT", "API_HOST"];

module.exports = function () {
  return {
    buildSandboxGlobals(defaultGlobals) {
      return Object.assign({}, defaultGlobals, {
        ENV: processEnvVars(envVars),
      });
    },
  };
};
// fastboot-server.mjs
import FastBootAppServer from "fastboot-app-server";
import { processEnvVars } from "ember-runtime-env";
import dotenv from "dotenv";
dotenv.config();

export const envVars = ["PORT", "API_HOST"];

const vars = processEnvVars(envVars);

const server = new FastBootAppServer({
  distPath: "dist",
  gzip: true,
  host: "0.0.0.0",
  port: vars.port ?? 4200,
  workerCount: 1,
  buildSandboxGlobals(globals) {
    return Object.assign({}, globals, { ENV: vars });
  },
});

server.start();

initialize the env service

This should typically be done in the application route by calling initialize in the beforeModel. This makes sure that the env loads no matter the incoming request. If you only want the environment loaded on specific routes, initialize the service accordingly.

import { type EnvService } from "ember-runtime-env";
import Route from "@ember/routing/route";
import { inject as service, type Registry as Services } from "@ember/service";

export default class ApplicationRoute extends Route {
  @service env!: EnvService;

  async beforeModel() {
    await this.env.initialize();
  }
}

Usage

To use the env service, inject it and then call getEnvVar. Note that your ENV_VARS have been converted to camelCase.

Here is an example where we're making an apiHost variable accessible in the application controller.

import Controller from "@ember/controller";
import { inject as service, type Registry as Services } from "@ember/service";

export default class ApplicationController extends Controller {
  @service env!: Services["env"];

  get apiHost(): string | undefined {
    return this.env.getEnvVar("apiHost");
  }
}

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.