Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mansona/ember-get-config

Get `config/environment` from anywhere, even addons!!!
https://github.com/mansona/ember-get-config

ember ember-addon hacktoberfest

Last synced: about 11 hours ago
JSON representation

Get `config/environment` from anywhere, even addons!!!

Awesome Lists containing this project

README

        

[![npm version](https://badge.fury.io/js/ember-get-config.svg)](https://badge.fury.io/js/ember-get-config)
[![GitHub Actions Build Status](https://img.shields.io/github/workflow/status/mansona/ember-get-config/CI/master)](https://github.com/mansona/ember-get-config/actions/workflows/ci.yml?query=branch%3Amaster)

# ember-get-config

Gaining access to an app's config file from an addon can be challenging. If possible, you should always get it through the container like so:

```js
export default Ember.Component.extend({
someFunction() {
const config = Ember.getOwner(this).resolveRegistration('config:environment');
. . . .
}
});
```

If you do not have access to the container though, you can always use `ember-get-config`.

## Installation

`ember install ember-get-config`

## Usage

Simply:

```js
import config from 'ember-get-config';
```

Which allows you to do handy things like:

```js
const { environment, modulePrefix } = config;
```

Boom!

## Contributing

See the [Contributing](CONTRIBUTING.md) guide for details.