Make web3 provider URL configurable; default to infura #9
@@ -77,7 +77,7 @@ export default Ember.Service.extend({
|
||||
this.getValueFromContract('kreditsContract', 'contributorAddresses', i).then(address => {
|
||||
this.getValueFromContract('kreditsContract', 'contributors', address).then(person => {
|
||||
this.getValueFromContract('tokenContract', 'balanceOf', address).then(balance => {
|
||||
console.debug('person', person);
|
||||
Ember.Logger.debug('person', person);
|
||||
let contributor = Contributor.create({
|
||||
address: address,
|
||||
github_username: person[1],
|
||||
@@ -166,7 +166,7 @@ export default Ember.Service.extend({
|
||||
return new Ember.RSVP.Promise((resolve, reject) => {
|
||||
this.get('ipfs').storeFile(contributor.serialize()).then(ipfsHash => {
|
||||
contributor.set('ipfsHash', ipfsHash);
|
||||
console.debug('ADD', address, name, ipfsHash, isCore, id);
|
||||
Ember.Logger.debug('ADD', address, name, ipfsHash, isCore, id);
|
||||
this.get('kreditsContract').addContributor(address, name, ipfsHash, isCore, id, (err, data) => {
|
||||
if (err) { reject(err); }
|
||||
Ember.Logger.debug('[kredits] add contributor response', data);
|
||||
|
||||
+13
-13
@@ -29,15 +29,24 @@ module.exports = function(environment) {
|
||||
}]
|
||||
]
|
||||
},
|
||||
|
||||
web3ProviderUrl: "https://parity.kosmos.org:8545",
|
||||
ethereumChain: "testnet",
|
||||
contractMetadata: {},
|
||||
ipfs: {
|
||||
host: 'localhost',
|
||||
port: '5001',
|
||||
protocol: 'http'
|
||||
}
|
||||
};
|
||||
if (process.env.KREDITS_CONTRACT_ADDR) {
|
||||
ENV.contractMetadata['Kredits'] = { address: process.env.KREDITS_CONTRACT_ADDR };
|
||||
}
|
||||
if (process.env.TOKEN_CONTRACT_ADDR) {
|
||||
|
|
||||
ENV.contractMetadata['Token'] = { address: process.env.TOKEN_CONTRACT_ADDR };
|
||||
}
|
||||
if (process.env.WEB3_PROVIDER_URL) {
|
||||
ENV.web3ProviderUrl = process.env.WEB3_PROVIDER_URL;
|
||||
} else {
|
||||
ENV.web3ProviderUrl = 'https://kovan.infura.io';
|
||||
}
|
||||
|
||||
if (environment === 'development') {
|
||||
// ENV.APP.LOG_RESOLVER = true;
|
||||
@@ -45,14 +54,6 @@ module.exports = function(environment) {
|
||||
// ENV.APP.LOG_TRANSITIONS = true;
|
||||
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
|
||||
// ENV.APP.LOG_VIEW_LOOKUPS = true;
|
||||
ENV.ethereumChain = 'dev';
|
||||
ENV.contractMetadata = {};
|
||||
if (process.env.KREDITS_CONTRACT_ADDR) {
|
||||
ENV.contractMetadata['Kredits'] = { address: process.env.KREDITS_CONTRACT_ADDR };
|
||||
}
|
||||
if (process.env.TOKEN_CONTRACT_ADDR) {
|
||||
ENV.contractMetadata['Token'] = { address: process.env.TOKEN_CONTRACT_ADDR };
|
||||
}
|
||||
}
|
||||
|
||||
if (environment === 'test') {
|
||||
@@ -67,8 +68,7 @@ module.exports = function(environment) {
|
||||
}
|
||||
|
||||
if (environment === 'production') {
|
||||
ENV.ethereumChain = 'testnet';
|
||||
ENV.web3ProviderUrl = 'https://ropsten.infura.io';
|
||||
// production conifig
|
||||
}
|
||||
|
||||
return ENV;
|
||||
|
||||
Reference in New Issue
Block a user
We use config files in Ember, so it's clear what is being built. Otherwise you end up with a build that completely hides where its config comes from.
Edit: loldidntread. Anyway, we shouldn't add even more env vars and use normal config options for all of them (as well as the addresses from the contracts module).
I see. what is the best option to set local dev configuration options? (like for example here the contract addresses?)
I guess this works for now. Would be nice to use environment-specific configs soon.
yep. I only see those used for configs that must not be in the repo / only for the current machine.
so defaulting to parity.kosmos.org:8545 and this PR is ok?
Yer.