Code Monkey home page Code Monkey logo

aurelia-configuration's People

Contributors

bbosman avatar dautushenka avatar derekpitt avatar doktordirk avatar eliranmal avatar gitter-badger avatar iainduff avatar jeroenvinke avatar joshmccullough avatar mikeesouth avatar nalch avatar omniscient avatar pszybiak avatar riddla avatar tomtomau avatar vheissu avatar wshayes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aurelia-configuration's Issues

Default config-folder-root moved

The default config-folder used by aurelia-configuration seems to have moved in 1.0.13. before it was ./src/config, now it's ./config.
When i noticed this, i tried setting the default root, but i found no option that allowed me to set it (i can set the config-folder, but not the root-folder).
My question is: How can i prevent future releases from breaking my config with changes like this one?

TypeError after upgrade 1.0.13 -> 1.0.14

After upgrading from 1.0.13 to 1.0.14, I am seeing this error:

bluebird.js:5236 TypeError: customConfig.configure is not a function
    at http://localhost:9000/aurelia-bootstrap.bundle.js:15605:27
From previous event:
    at config (http://localhost:9000/aurelia-bootstrap.bundle.js:15604:46)
    at handleApp (http://localhost:9000/aurelia-bootstrap.bundle.js:15595:10)
    at http://localhost:9000/aurelia-bootstrap.bundle.js:15623:9
From previous event:
    at http://localhost:9000/aurelia-bootstrap.bundle.js:15620:44
From previous event:
    at run (http://localhost:9000/aurelia-bootstrap.bundle.js:15617:24)
    at Object.<anonymous> (http://localhost:9000/aurelia-bootstrap.bundle.js:15642:1)
    at Object.aurelia-bootstrapper-webpack (http://localhost:9000/aurelia-bootstrap.bundle.js:15643:30)
    at __webpack_require__ (http://localhost:9000/aurelia-bootstrap.bundle.js:57:38)
    at Object.313 (http://localhost:9000/aurelia-bootstrap.bundle.js:14480:1)
    at __webpack_require__ (http://localhost:9000/aurelia-bootstrap.bundle.js:57:38)
    at 111 (http://localhost:9000/aurelia-bootstrap.bundle.js:140:18)
    at http://localhost:9000/aurelia-bootstrap.bundle.js:143:10

Using v 1.0.13 I never saw this error.

Plugin initialization bug

Someone already reported that issue, but closed it after reverting to previous version of the plugin.

When I try to use the plugin i'm getting this:

Unhandled rejection Error: (SystemJS) Error: key/value cannot be null or undefined. Are you trying to inject/register something that doesn't exist with DI?

From my observations it looks like configure method is not being called and plugin is not initialised properly. My code is the same as README samples. Using version 1.0.12.

I can also confirm that version 1.0.11 seems to work fine.

Support Webpack

I tried to install this plugin into the Aurelia Webpack Typescript Skeleton, and when I run I get the following error:

 ERROR in ./~/aurelia-configuration/dist/commonjs/index.js
 Module not found: Error: Can't resolve './aurelia-configuration' in 'C:\my\project\node_modules\aurelia-configuration\dist\commonjs'
 @ ./~/aurelia-configuration/dist/commonjs/index.js 7:28-62

It seems that this line: var _aureliaConfiguration = require('./aurelia-configuration'); in aurelia-configuration/dist/commonjs/index.js is being interpreted as a webpack require (I think).

I am not sure if there is a way around this, but I would love to use this plugin.

Configuration file could not be found or loaded

I'm getting the error: Configuration file could not be found or loaded.

I have 'config/application.json' in my root directory. Same place as I put it in a new install of the skeleton app (Aurelia Beta version) which worked fine. Not sure what the next steps are for troubleshooting. I've done some debugging but it steps into the shim.js file, and I'm lost at that point. Any ideas on next steps? Thanks!

Excerpts from config.js:
"aurelia-animator-css": "npm:[email protected]",
"aurelia-auth": "github:paulvanbladel/[email protected]",
"aurelia-bootstrapper": "npm:[email protected]",
"aurelia-configuration": "github:vheissu/[email protected]",
"aurelia-fetch-client": "npm:[email protected]",
"aurelia-framework": "npm:[email protected]",
"aurelia-history-browser": "npm:[email protected]",
"aurelia-loader-default": "npm:[email protected]",
"aurelia-logging-console": "npm:[email protected]",
"aurelia-router": "npm:[email protected]",
"aurelia-templating-binding": "npm:[email protected]",
"aurelia-templating-resources": "npm:[email protected]",
"aurelia-templating-router": "npm:[email protected]",
"babel": "npm:[email protected]",
"babel-runtime": "npm:[email protected]",
"bootstrap": "github:twbs/[email protected]",
"core-js": "npm:[email protected]",
"fetch": "github:github/[email protected]",
"font-awesome": "npm:[email protected]",
"text": "github:systemjs/[email protected]",
...
"github:vheissu/[email protected]": {
"aurelia-dependency-injection": "github:aurelia/[email protected]",
"aurelia-event-aggregator": "github:aurelia/[email protected]",
"aurelia-http-client": "github:aurelia/[email protected]",
"core-js": "npm:[email protected]"
},

From Chrome:
Here is the error snapshot: https://www.evernote.com/l/AAKq1zmclN1BxK2N661HIGo_WUo5FnsJ_PU

Setting the environment

Nice plugin! I'm trying to figure out how to deploy with different environments (e.g. Dev, Staging, Prod) without changing my Aurelia configuration file. What would you recommend? I was thinking about using document.location.host to set my environment. Is there a better way?

aurelia-configurator.js not found

I installed everything with jspm, if I try to do import {Configure} from 'aurelia-configuration'; it replies with ENOENT: no such file or directory, open '......../src/aurelia-configuration.js'so it seems not to find the plugin (for whatever reason). If I am going to add 'aurelia-configuration' to the dependencies in aurelia.json it blames me with no such file or directory, open 'node_modules/aurelia-configuration/package.json', node_modules are done with npm, so after doing npm install aurelia-configuration --save a new error comes along stating ENOENT: no such file or directory, open ......../src/configure.js
I also added the .use directive into the main.js, so followed the instructions exactly ...
... however, I am not sure what I am missing, any help (maybe update of readme) appreciated.

Thanks

Question: Overwriting a value if a particular browser version

Hi,

Given my config.json:

"development": {
    "api": {
      "key": "developmentonlykey938109283091",
      "endpoint": "http://localhost:53559/api/"
    }
  },

What would be the best way to overwrite that value if a particular condition is true?

I tried something like this but to no avail:

aurelia.use.plugin('aurelia-configuration', config => {
    config.setEnvironments({
        development: ['localhost', 'dev.local'],
        staging: ['test.yyy.com'],
        production: ['prod.org']
    });  

    if (1 == 1) {    
        config.set('development.api.endpoint', 'ApiProxy?route=')
    }
});

Error: ENOENT: no such file or directory src/aurelia-configuration.js

Hello,
I'm using the aurelia-cli
I have the following versions:

  "dependencies": {
    "aurelia-animator-css": "^1.0.0",
    "aurelia-bootstrapper": "^1.0.0",
    "aurelia-configuration": "^1.0.12",
    "aurelia-fetch-client": "^1.0.0",
    "bluebird": "^3.4.1"
  },
  "peerDependencies": {},
  "devDependencies": {
    "aurelia-cli": "^0.19.0",
    "aurelia-testing": "^1.0.0-beta.2.0.0",
    "aurelia-tools": "^0.2.2",
    "browser-sync": "^2.13.0",
    "connect-history-api-fallback": "^1.2.0",
    "gulp": "github:gulpjs/gulp#4.0",
    "gulp-changed-in-place": "^2.0.3",
    "gulp-plumber": "^1.1.0",
    "gulp-rename": "^1.2.2",
    "gulp-sourcemaps": "^2.0.0-alpha",
    "gulp-notify": "^2.2.0",
    "minimatch": "^3.0.2",
    "through2": "^2.0.1",
    "uglify-js": "^2.6.3",
    "vinyl-fs": "^2.4.3",
    "babel-eslint": "^6.0.4",
    "babel-plugin-syntax-flow": "^6.8.0",
    "babel-plugin-transform-decorators-legacy": "^1.3.4",
    "babel-plugin-transform-es2015-modules-amd": "^6.8.0",
    "babel-plugin-transform-es2015-modules-commonjs": "^6.10.3",
    "babel-plugin-transform-flow-strip-types": "^6.8.0",
    "babel-preset-es2015": "^6.9.0",
    "babel-preset-es2015-loose": "^7.0.0",
    "babel-preset-stage-1": "^6.5.0",
    "babel-polyfill": "^6.9.1",
    "babel-register": "^6.9.0",
    "gulp-babel": "^6.1.2",
    "gulp-eslint": "^2.0.0",
    "jasmine-core": "^2.4.1",
    "karma": "^0.13.22",
    "karma-chrome-launcher": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-babel-preprocessor": "^6.0.1"
  }

I followed the instructions from the README.md

I stuck this code on top of my class in app.js

import {inject} from 'aurelia-framework';
import {Configure} from 'aurelia-configuration';

@inject(Configure)
export class App {
  constructor(config) {

But upon building the app or trying to run it (au run --watch), following error shows up:

Starting 'writeBundles'...
Tracing app...
{ uid: 10,
  name: 'writeBundles',
  branch: false,
  error: 
   { [Error: ENOENT: no such file or directory, open '[project full dir]/src/aurelia-configuration.js']
     errno: -2,
     code: 'ENOENT',
     syscall: 'open',
     path: '[project full dir]/src/aurelia-configuration.js',
     moduleTree: [ 'app' ],
     fileName: '[project full dir]/src/app.js' },
  duration: [ 0, 380265785 ],
  time: 1473865349453 }

bundle application.json or ability to use json object only

making always an extra http request for the application.json on production seems unneeded. i'd like an option either to bundle the json somehow, or to removing the autoloading and using setAll myself with an json object i have in eg main.js without the then unneeded application.json loading

Cannot read property '__useDefault' of undefined

Hi,
I am having a typescript based aurelia cli project. The issue is when I try to load the Aurelia-Configuration plugin I get the following error

DEBUG [aurelia] Loading plugin aurelia-configuration.
vendor-bundle.js:21077 Uncaught TypeError: Cannot read property '__useDefault' of undefined

Not sure if I am doing anything wrong as I do not see any error on the cli console. I have added the dependency of aurelia-configuration in aurelia.json

Typescript definition error

I've been trying to use the definitions in dist but i'm getting the following error while building:

custom_typings\aurelia-configuration.d.ts(211,1): error TS1128: Declaration or statement expected.
custom_typings\aurelia-configuration.d.ts(211,16): error TS1005: ';' expected.

Typescript version "typescript@^1.9.0-dev.20160622-1.0",

Unhandled promise rejection Error: Loader must implement loadText(url)

I've just installed aurelia-configuration from jspm on an Aurelia application based on the navigation-skeleton. I've set up some basic config.json and initialized the plugin on main.js, but now the application won't load up anymore, throwing the following error

Unhandled promise rejection Error: Loader must implement loadText(url)

It seems like aurelia-configuration is using the aurelia-loader abstract module instead of it's default implementation.

Am I missing something or has something changed in the dependencies?

I have still not upgraded my aurelia app to use Babel 6 by the way, in case that is relevant.

doesn't install properly using jspm for systemjs

installing as jspm install aurelia-configuration. systemjs is the module loader.

when running in chrome, the following error message occurs:

Unhandled rejection Error: (SystemJS) Error: XHR error (404 Not Found) loading [...]/jspm_packages/github/vheissu/[email protected]

Which makes sense, as that file is indeed missing. Every other aurelia module installation does include a corresponding file. So it appears that this type of file is required by commonjs (I'm a newbie on this stuff so can't speculate any further.)

At any rate, the aurelia-configuration modeul will not load.

Configure isn't loading config.json

I'm calling this: .plugin('aurelia-configuration')

but Configure.loadConfig is never being invoked. The docs don't state that this must be called manually.

(I'm using JSPM/SystemJs)

Cannot find module './config/config.json'

I have followed the steps for using this with webpack.

When I do, I get the following error:

Error: Cannot find module './config/config.json'.

This prints in the console right after DEBUG [aurelia] Loading plugin aurelia-configuration.

I have double checked and the file is in dist/config/config.json.

Is there something I am missing?

Error when installing it through typings

Hello.
I'm facing an error trying to install the typings.

First I runned the jspm install:

jspm install aurelia-configuration

Fore some reason I still need to run typings install for every dependency because the .ts doesn't recognize the imports.

typings install github:vheissu/aurelia-configuration

But running the typings install returned this error

 typings WARN badlocation "github:vheissu/aurelia-configuration" is mutable and may change, consider specifying a commit hash
 typings ERR! message Unable to resolve "github:vheissu/aurelia-configuration"
 typings ERR! caused by https://raw.githubusercontent.com/vheissu/aurelia-configuration/master/typings.json responded with 404, expected it to equal 200

Does anyone know how to fix this problem? I'm using the aurelia typescript skeleton template.

aurelia-configuration.d.ts should define a module

OK, I'm a newbie at typescript and typings, but I have not been able to import aurelia-configuration as the d.ts files are written. The crux seems to be that it doesn't define a module.

  1. First, though perhaps not relevant, I renamed it index.d.ts, for consistency with every other typings file I've ever seen

  2. second, I merged the contents of the configure.d.ts into the newly-renamed index.d.ts as follows, and it works:

declare module 'aurelia-configuration' {

import { Loader } from 'aurelia-loader';

interface ConfigInterface {
}

class Configure {
    loader: Loader;
    environment: string;
    environments: any;
    directory: string;
    config_file: string;
    cascade_mode: boolean;
    private _config_object;
    private _config_merge_object;
    constructor(loader: Loader);
    setDirectory(path: any): void;
    setConfig(name: any): void;
    setEnvironment(environment: any): void;
    setEnvironments(environments?: boolean): void;
    setCascadeMode(bool?: boolean): void;
    obj: ConfigInterface;
    config: string;
    is(environment: any): boolean;
    check(): void;
    environmentEnabled(): boolean;
    environmentExists(): boolean;
    get(key: any, defaultValue?: any): any;
    set(key: any, val: any): void;
    merge(obj: any): void;
    lazyMerge(obj: any): void;
    setAll(obj: any): void;
    getAll(): ConfigInterface;
    loadConfig(): Promise<void>;
    loadConfigFile(path: any, action: any): Promise<void>;
    mergeConfigFile(path: any): Promise<void>;
}

    export function configure(aurelia: any, configCallback: any): Promise<{}>;

    export { Configure };
}

Crash in DI trying to load 1.0.13

Honestly, do you test of this plugin? Sorry for my frustration, but I have yet to obtain a build of this aurelia-configuration that is usable without modification. So I will be backing out to 1.0.11, again.

With v1.0.13, using system.js to load the module, I get the following exception. The plugin is unusable as such:

Message: key/value cannot be null or undefined. Are you trying to inject/register something that doesn't exist with DI?

Inner Error Stack:
Error: key/value cannot be null or undefined. Are you trying to inject/register something that doesn't exist with DI?
    at Container.get (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:567:15)
    at Object.invoke (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:424:33)
    at InvocationHandler.invoke (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:389:168)
    at Container.invoke (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:651:25)
    at StrategyResolver.get (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:130:37)
    at Container.get (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:582:41)
    at Object.invoke (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:418:33)
    at InvocationHandler.invoke (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:389:168)
    at Container.invoke (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:651:25)
    at StrategyResolver.get (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:130:37)
    at Container.get (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:582:41)
    at Object.invoke (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:418:33)
    at InvocationHandler.invoke (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:389:168)
    at Container.invoke (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:651:25)
    at StrategyResolver.get (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:130:37)
    at Container.get (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:582:41)
End Inner Error Stack
------------------------------------------------

    at Container.get (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:567:15)
    at Object.invoke (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:424:33)
    at InvocationHandler.invoke (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:389:168)
    at Container.invoke (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:651:25)
    at StrategyResolver.get (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:130:37)
    at Container.get (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:582:41)
    at Object.invoke (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:418:33)
    at InvocationHandler.invoke (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:389:168)
    at Container.invoke (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:651:25)
    at StrategyResolver.get (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:130:37)
    at Container.get (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:582:41)
    at Object.invoke (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:418:33)
    at InvocationHandler.invoke (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:389:168)
    at Container.invoke (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:651:25)
    at StrategyResolver.get (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:130:37)
    at Container.get (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:582:41)
End Inner Error Stack
------------------------------------------------

    at new AggregateError (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-pal.js:38:13)
    at Container.invoke (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:653:15)
    at StrategyResolver.get (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:130:37)
    at Container.get (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:582:41)
    at Object.invoke (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:418:33)
    at InvocationHandler.invoke (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:389:168)
    at Container.invoke (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:651:25)
    at StrategyResolver.get (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:130:37)
    at Container.get (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:582:41)
    at Object.invoke (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:418:33)
    at InvocationHandler.invoke (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:389:168)
    at Container.invoke (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:651:25)
    at StrategyResolver.get (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:130:37)
    at Container.get (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-dependency-injection.js:582:41)
    at ValueConverterResource.initialize (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-binding.js:4917:33)
    at ResourceDescription.initialize (http://localhost:51323/jspm_packages/npm/[email protected]/aurelia-templating.js:2980:21)

No environment selected warning

Just a question to hear your thoughts. I just deployed earlier but after changing domain names and not updating my environments correctly, I hit the issue that the config variable I was looking for was unavailable and then it broke some stuff temporarily.

My question was whether it would make sense to be console.warn or something when some environments have been provided, but aurelia-configuration was unable to match to any of them. Alternatively, logging a warning when a key is not available (and no default value has been provided) Open to reasoning against it though!

Cheers for making this too, heaps useful.

get() returns the parent object instead of a primitive value

description

when retrieving config values via the get() function, the returned value is the object wrapping the value, and not the value itself.

steps to reproduce

  1. create a config file with the default configuration (don't change the file path or name), with a nested object, e.g.:

    {
        "exit": {
            "timeout": {
                "duration": 2000
            }
        }
    }
    
  2. inject the config service into a view

  3. after the app bootstrap, and the view is attached, attempt to retrieve a nested value, e.g.:

    let duration = this.config.get('exit.timeout.duration');
    

expected result

the retrieved value reference (duration) should have the config primitive value, e.g. 2000.

actual result

the retrieved value reference holds the wrapping object instead, e.g. { "duration": 2000 }.

environment details

  • jspm version: 1.0.4
  • OS: linux ubuntu 15.10 64-bit
  • browser: chromium 48.0.2564.116

config files and git and security.

Although security is less of an issue for client side config files, it still matters.
Especially in enterprise context, sometimes production config files are only merged-in during deployment by the operations teams and devs even never see the production config files. So, ... YMMV.

As far as I can see aurelia-configuration has all is environments in one file. Could be maybe an interesting option to allow multiple files. Should be doable with a decent merge function ? :)

Thanks for the great plugin.

Aurelia/Core-JS dependencies need updating

After upgrading my project to Aurelia Beta 1 and bundling, I am seeing duplicates and old versions included in the bundle in my config.js that seem to be related to this package. Aurelia has also updated their Core-JS dependency to 1.2.6 so I am seeing a duplicate of that.

Here are the specific packages being added to the bundler by using your package right now. You can check this in the config.js under bundles:

{
      "github:aurelia/[email protected]",
      "github:aurelia/[email protected]/aurelia-dependency-injection",
      "github:aurelia/[email protected]",
      "github:aurelia/[email protected]/aurelia-event-aggregator",
      "github:aurelia/[email protected]",
      "github:aurelia/[email protected]/aurelia-http-client",
      "github:aurelia/[email protected]",
      "github:aurelia/[email protected]/aurelia-logging",
      "github:aurelia/[email protected]",
      "github:aurelia/[email protected]/aurelia-metadata",
      "github:aurelia/[email protected]",
      "github:aurelia/[email protected]/aurelia-path"
}

http-client dependency

It's a shame to have such a great configuration plugin depend on just one http-client implementation.

For our own project, we aren't using Aurelia's http-client at all, and we don't want to include it just for getting this plugin working.

Any way we can inject the .json file ourselves, feed it to the configuration instance, and forget all about the aurelia-http-client :) ?

Typescript d.ts still doesn't work in 1.0.13

The typings d.ts in v1.0.13 still doesn't define "aurelia-configuration". It should be named index.d.ts, not aurelia-validation.d.ts. It is not findable by 'typings', that I am able to accomplish.

How do I use it with aurelia-auth?

All the examples show how to use aurelia-configuration in view-models. How do I use aurelia-config to configure a plugin(like aurelia-auth)?

Namespaced item doesn't work in cascade mode

By example:

{
    "name": "Test Application",
    "api": {
        "key": "somekey",
        "endpoint": "http://www.google.com/"
    },
    "development": {
        "api": {
            "key": "developmentonlykey938109283091",
            "endpoint": "http://localhost/api/v1"
        }
    }
}
export function configure(aurelia) {
    aurelia.use
        .standardConfiguration()
        .developmentLogging()
        .plugin('aurelia-configuration', config => {
            config.setEnvironments({
                development: ['localhost', 'dev.local'],
                staging: ['staging.website.com', 'test.staging.website.com'],
                production: ['website.com']
            });
        });

    aurelia.start().then(a => a.setRoot());
}

In production environment, when I call

var value = config.get('api.key');

value is null but should be http://www.google.com/.

using in cordova project - loader just stops

I have an aurelia cli project (works perfect in browser) however when I compile and run in xcode it crashes simulator during the aurelia-configuration plugin initialization. There are no errors logged, it simply stops. At first I was getting a config file not found error but I solved that by changing the directory as follows:


.plugin('aurelia-configuration', (config) => {  
        config.setDirectory('./config');  
        config.setConfig('config.json');  
    })

Now I see the config file loading in xcode but it still simply hangs the process.

If I comment the above code my project builds and runs perfectly in xcode.

I really like the way this plugin works, however if I cannot solve this issue in cordova then I simply cannot use it.

error TS2322: Type 'typeof Configure' is not assignable to type 'Configure'.

I'm getting a TS2322 error when trying to use this plugin.

In my main.ts auerlia config file I have the following

aurelia.use
    .standardConfiguration()
    .developmentLogging()
    .plugin("aurelia-cookie")
    .plugin("aurelia-configuration", config => {
        config.setEnvironments({
            development: ["localhost", "dev.local"],
            testing: ["test.mydomain.com"]
        });
    });

In my view model I have the following

import { Configure } from "aurelia-configuration";
@autoinject()
export class Home {
constructor() {

    this.config = Configure;
}

Initially, when trying to get this up and running I got an error like the below

Error: app\modules\orders\home\home.ts(2,27): error TS2306: File 'C:/Users/phk/path/to/my/app/node_modules/aurelia-configuration/dist/index.d.ts' is not a module.

I found this - #57 - and tried making these changes, which evolved the error, to what I currently have:

error TS2322: Type 'typeof Configure' is not assignable to type 'Configure'. Property 'loader' is missing in type 'typeof Configure'.

I've installed the plugin via jspm and npm but no joy.

Readme is confusing

Readme is confusing. For example:
code block just after "Add plugin to your app's main.js:" and next code block are different, hard to follow what was changed. And ".plugin('aurelia-configuration')" block has been removed

Merge doesn't actually merge the incoming object.

Merge doesn't work with deep properties which, I believe, is the 90% case. E.g.:

config.merge({
    "local": {
        "someApi": {
            "url": "http://production.com/api",
            "username": "the_username",
            "password": "the_password"
        }
    }
});
config.merge({
    "local": {
        "someApi": {
            "url": "http://localhost/my-api"
        }
    }
});

The last merge wins, and local will look exactly like it does in the last-merged object. Other properties which were previously in place (username and password) are now gone. The intention, in this case, was to simply update the value of the local.someApi.url property.

Error: key/value cannot be null or undefined. Are you trying to inject/register something that doesn't exist with DI?

Hi,

I'm trying to use aurelia-configuration on my project and I'm getting the erro: "key/value cannot be null or undefined. Are you trying to inject/register something that doesn't exist with DI?". I've created the file config/config.json and config/application.json (which is the correct one?). Can I have some help to solve this problem?

my main.js file:

export function configure(aurelia) {
  aurelia.use
      .standardConfiguration()
      .developmentLogging()
      .plugin('aurelia-configuration', config => {
        console.log(config);
      });

  aurelia.start().then(() => aurelia.setRoot());
}

Usage in viewModel:

import {Configure} from 'aurelia-configuration';
[...]
@inject(Configure)
export class Processos {
  constructor(configAurelia) {
    console.log(configAurelia);
  }
}

error loading deep-extend in 1.0.6

just installed new release 1.0.6

Uncaught (in promise) Error: XHR error (404 Not Found) loading http://localhost:9000/dist/deep-extend.js(…)

deep-extend is in package.json in dependencies, not jspm dependencies...

circumvented the error for now by manually installing it via jspm install npm:deep-extend

Error reading "config.json" - Unhandled rejection Error: Module parse failed

I am using webpack. I followed the steps given in "Getting Started" section in Readme.
However, I am getting following error while loading the "config.json" itself.

Unhandled rejection Error: Module parse failed: C:\myproject\src\config\config.json Unexpected token (2:6)
You may need an appropriate loader to handle this file type.
| {
|   "api": {
|       "baseUrl": "http://localhost:8080/"
|   }
    at Object.261 (http://localhost:9000/app.bundle.js:28649:7)
    at __webpack_require__ (http://localhost:9000/aurelia-bootstrap.bundle.js:57:38)
    at webpackContext (http://localhost:9000/app.bundle.js:28406:9)
    at http://localhost:9000/aurelia-bootstrap.bundle.js:15642:48
From previous event:
    at Promise.then._this2.modulesBeingLoaded.(anonymous function) (http://localhost:9000/aurelia-bootstrap.bundle.js:15641:99)
From previous event:
    at WebpackLoader._import (http://localhost:9000/aurelia-bootstrap.bundle.js:15629:18)
    at WebpackLoader.loadText (http://localhost:9000/aurelia-bootstrap.bundle.js:15695:17)
    at Configure.loadConfigFile (http://localhost:9000/app.bundle.js:11425:28)
    at Configure.loadConfig (http://localhost:9000/app.bundle.js:11415:21)
    at http://localhost:9000/app.bundle.js:38239:18
From previous event:
    at Object.configure (http://localhost:9000/app.bundle.js:38238:12)
    at http://localhost:9000/aurelia.bundle.js:14553:34
From previous event:
    at _loadPlugin (http://localhost:9000/aurelia.bundle.js:14551:40)
    at http://localhost:9000/aurelia.bundle.js:14544:14
From previous event:
    at loadPlugin (http://localhost:9000/aurelia.bundle.js:14543:73)
    at next (http://localhost:9000/aurelia.bundle.js:14804:18)
From previous event:
    at next (http://localhost:9000/aurelia.bundle.js:14804:54)
    at http://localhost:9000/aurelia.bundle.js:14811:14
From previous event:
    at FrameworkConfiguration.apply (http://localhost:9000/aurelia.bundle.js:14796:42)
    at Aurelia.start (http://localhost:9000/aurelia.bundle.js:14413:21)
    at Object._callee$ (http://localhost:9000/app.bundle.js:13428:28)
    at tryCatch (http://localhost:9000/aurelia-bootstrap.bundle.js:9271:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (http://localhost:9000/aurelia-bootstrap.bundle.js:9545:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (http://localhost:9000/aurelia-bootstrap.bundle.js:9304:21)
    at step (http://localhost:9000/app.bundle.js:13467:191)
    at http://localhost:9000/app.bundle.js:13467:451
From previous event:
    at Object.<anonymous> (http://localhost:9000/app.bundle.js:13467:99)
    at Object.configure (http://localhost:9000/app.bundle.js:13443:17)
    at http://localhost:9000/aurelia-bootstrap.bundle.js:15454:27
From previous event:
    at config (http://localhost:9000/aurelia-bootstrap.bundle.js:15453:46)
    at handleApp (http://localhost:9000/aurelia-bootstrap.bundle.js:15444:10)
    at http://localhost:9000/aurelia-bootstrap.bundle.js:15472:9
From previous event:
    at http://localhost:9000/aurelia-bootstrap.bundle.js:15469:44
From previous event:
    at run (http://localhost:9000/aurelia-bootstrap.bundle.js:15466:24)
    at Object.<anonymous> (http://localhost:9000/aurelia-bootstrap.bundle.js:15491:1)
    at Object.aurelia-bootstrapper-webpack (http://localhost:9000/aurelia-bootstrap.bundle.js:15492:30)
    at __webpack_require__ (http://localhost:9000/aurelia-bootstrap.bundle.js:57:38)
    at Object.259 (http://localhost:9000/aurelia-bootstrap.bundle.js:13363:1)
    at __webpack_require__ (http://localhost:9000/aurelia-bootstrap.bundle.js:57:38)
    at 10 (http://localhost:9000/aurelia-bootstrap.bundle.js:140:18)
    at http://localhost:9000/aurelia-bootstrap.bundle.js:143:10

update-dependencies fork is not current

The current head doesn't refer to the beta version of Aurelia on npm.
Current workaround requires
jspm install aurelia-configuration=github:derekpitt/Aurelia-Configuration@update-dependencies
(fork by derekpitt)

ETA to have a new package for the mid-october release?

Hi,

I saw that you started working on upgrading your code to support the mid-october Aurelia release. Do you have an ETA as to when the new package will be published?

Also, I must say that your plugin saved me a lot of time.. keep up the good work! :)

handling multidimensions in config.json

The plugin should consider multidimensions in config.json (see example below). In the actual release, only 2 levels are supported.

Configure.prototype.get = function get(key) {
...
var splitKey = key.split('.');
var _parent = splitKey[0];
var child = splitKey[1];

var dynamicVarName = "this.obj";

if (this.environmentEnabled()) {
    if (this.environmentExists()) {
        dynamicVarName += '["'+this.environment+'"]';
    }
}

for( var i = 0; i < splitKey.length; i++ ){
    dynamicVarName += '["'+splitKey[i]+'"]';    
}

console.log( eval ( dynamicVarName ) ? eval ( dynamicVarName ) : defaultValue );
return eval ( dynamicVarName ) ? eval ( dynamicVarName ) : defaultValue;
...
}

thank's to build the next release with this modification.

Error: loader must implement loadText(url)

i'm just trying to load the 'aurelia-configuration' plugin and get the following error:

loader must implement loadText(url)

export function configure(aurelia) {
    aurelia.use
        .standardConfiguration()
        .developmentLogging()
        .plugin('aurelia-configuration');

    aurelia.start().then(a => a.setRoot('pages/app', document.body));
}

image

Merging configuration

I'd like to be able to merge the configuration object instead of setting property by property. e.g: getting partial config json from server and merging to the local.

Getting a 404 loading [email protected]

Hello. I'm getting a 404 from aurelia-configuration on a fresh install:

http://localhost:9000/jspm_packages/github/vheissu/[email protected] -> 404

My config file is at /config/config.json which should be the default.

My main.js is as follows:

export function configure(aurelia) {
  aurelia.use
    .standardConfiguration()
    .developmentLogging()
    .plugin('aurelia-configuration', config => {
      config.setCascadeMode(false);
      config.setEnvironments({
        development: ['localhost', '192.168.*.*'],
        production: ['brandonftaylor.com', 'www.brandonftaylor.com']
      });
    })
    .plugin('aurelia-validation');

The stack trace from Chrome Developer Tools:

system.js:4 Uncaught (in promise) Error: XHR error (404 Not Found) loading http://localhost:9000/jspm_packages/github/vheissu/[email protected]
    Error loading http://localhost:9000/jspm_packages/github/vheissu/[email protected]
    at o (http://localhost:9000/jspm_packages/system.js:4:12694)
    at XMLHttpRequest.s.onreadystatechange (http://localhost:9000/jspm_packages/system.js:4:13219)t @ system.src.js:4597g @ system.src.js:4597(anonymous function) @ system.src.js:4597

Thoughts?

ESNext Webpack config.json file not found

Using the ESNext Webpack skeleton navigation project, when I build the app for prod using npm run build:prod and run the app using npm run server:prod and browser to http://localhost:8080/

I get the following error GET http://localhost:8080/config/config.json 404 (Not Found)

How do i use webpack to load in the config/config.json file?

I don't have this error however when i run npm start and everything works fine.

Plugin config should support promises.

Current behavior:
Plugin configuration callbacks are expected run synchronously.

Expected/desired behavior:

  • What is the expected behavior?
    The callback passed into aurelia.use.plugin to configure the plugin should allow for the return of a Promise. Configuration of Aurelia should not be considered "done" until all plugin configuration callbacks have been resolved or rejected.
  • What is the motivation / use case for changing the behavior?
    To allow for more complex/async configuration of plugins, before Aurelia is loaded.

Example

aurelia.use
    .standardConfiguration()
    .plugin('aurelia-configuration', config => {
        config.setDirectory(System.baseURL + '/config');
        config.setConfig('application.json');
        config.setEnvironment('development');

        // Returns a promise.
        return config.mergeConfigFile(`${config.directory}/application-overrides.json`);
    });

return aurelia.start().then(a => a.setRoot());

Workaround

let promises = [];

aurelia.use
    .standardConfiguration()
    .plugin('aurelia-configuration', (config) => {
        config.setDirectory(System.baseURL + '/config');
        config.setConfig('application.json');
        config.setEnvironment('development');

        promises.push(config.mergeConfigFile(`${config.directory}/application-overrides.json`));
    });

// Allow any async configuration to complete before starting Aurelia.
return Promise
    .all(promises)
    .then(() => {
        return aurelia.start().then(a => a.setRoot());
    });

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.