-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Environments #135
Environments #135
Conversation
For example, to make a build for android in the QA enviroment, you need to run: ENV=qa ionic build android
Current coverage is 91.95% (diff: 100%)
|
Just went to merge this. What's the purpose of the https://github.com/camolin3/clicker/tree/enviroments/config/dev/app |
The idea is to place specific files for each environment. export class constants {
public static get API_ENDPOINT(): string { return 'http://localhost:5432/api/'; }
} You need to place the appropriate GIT only track files but not empty directories, so thats why I added the |
Ah I see!
Yes, I don't think it's really clear what those folders are for, though from the gulp file you can infer it. It all feels quite implicit, but with an example it's clearer. Duplicating the apps' directory structure inside the config directory (for whichever files need access to config), per environment, seems excessive to me. I'd much rather have one export config {
services: {
'API_ENDPOINT': 'http://localhost:5432/api/'
}
} import { config } from '../config';
console.log(config.services.API_ENDPOINT); The above syntax is almost certainly incorrect but I hope it's instructive to what I'm getting at. For one given component / service I may currently have four files:
I don't want to add another file for it in a different directory structure elsewhere. However! This is all extremely subjective. If the Thanks! |
I agree with you. The problem with your approach is, that which of the import { config } from '../config/dev/constants';
// or maybe
import { config } from '../config/qa/constants'
// or
import { config } from '../config/prod/constants'
// ... Now we need to decide on runtime which file to use; I rather prefer to keep environment logic outside of the application code. Maybe, instead of replicating all the filesystem, we could place the env-specific files just inside
to this
and modify the gulp task to move all the .ts files inside |
Yes this is exactly what I meant, apologies if it was unclear: import { config } from '../config/constants'; where the gulp task populates |
If I get to this before you I will make those changes and merge in. I think it would be instructive to have an example with a log line somewhere in the app that gets loaded from If you have time to make such an example please feel free! I'll put a message on this before I start so there's no duplicating effort. Thanks again for the PR |
Not ignoring this, just very busy. Will be merged when I have time. |
implementation of #134