marcorinck / ngStart

skeleton project for new angular.js projects
MIT License
195 stars 29 forks source link

It would be great to have some config file to hold global values #18

Closed sergeykosik closed 11 years ago

sergeykosik commented 11 years ago

It would be useful to introduce some config file, so to share global constants and values across modules. Services might need to use the global baseUrl value. The config file should be separated out to ensure team members can have there own specific settings.

marcorinck commented 11 years ago

Yes, you definitely need this in a real project. But why do think it should be included in this skeleton project?

In my real project I have a config module which holds an injectable configFactory where all config is placed. But thats just the same as the example modules "about" and "contact", it would add nothing to this project as a skeleton.

Or isn't, it?

sergeykosik commented 11 years ago

I believe it would be easier for beginners to see where to place constants once such a place is available out of the box. Initially I tried to set the baseUrl constant in the app.js, but then realised that my co-workers will have to set their own value, which shouldn't be committed to the repo. Also, I was stumbled on testing my controllers, which had dependencies on the services with constant baseUrl as that constant was not available.

marcorinck commented 11 years ago

I'll have to think this through if there is enough reason to implement it here. Right now, I think its very much dependent on the individual situation of the developer team.

But I will think about it.

akohout commented 11 years ago

+1 for providing an example of where to put constants for configuration

This project should also be helpful for everyone to kickstart a new app, and since everyone has to do that, you could provide a good solution for this.

marcorinck commented 11 years ago

it took a while longer as expected bc of personal problems, but I just have introduced a config system.

There is now a new module: "config" with configuration files for every environment you want, standard config is in "config/configuration.js", add new files as "config/configuration_environmentname.js" for every new environmnet you want. They get picked up automatically during build.

You run builds for environments via "grunt install:environmentname", normal "grunt install" uses standard config.

I have included a sample environment file for a "prod" environment.

marcorinck commented 11 years ago

just released 0.2.0, closing this

akohout commented 11 years ago

I like your solution :+1: