Kaynağa Gözat

add Tencent cloud

邓心一 7 yıl önce
ebeveyn
işleme
cad460a739
1 değiştirilmiş dosya ile 12 ekleme ve 7 silme
  1. 12 7
      truffle.js

+ 12 - 7
truffle.js

@@ -15,13 +15,19 @@
 const { readFileSync } = require('fs')
 const LoomTruffleProvider = require('loom-truffle-provider')
 
-const env = 'remote' // 'remote' for remove disposition, 'local' for local test
+const env = 'ubuntu' // 'ubuntu' or 'centos' for remove disposition, 'local' for local test
 
 let ipAddr
+let keyPath
 if (env === 'local') {
   ipAddr = '127.0.0.1'
-} else if (env === 'remote') {
-  ipAddr = '10.108.39.133'
+  keyPath = './private_key'
+} else if (env === 'ubuntu') {
+  ipAddr = '10.108.39.133' // Lab
+  keyPath = './private_key'
+} else if (env === 'centos') { // Problems remain
+  ipAddr = '111.230.181.241' // Tencent cloud
+  keyPath = './privateKey'
 }
 
 const chainId = 'default'
@@ -30,8 +36,7 @@ const readUrl = `http://${ipAddr}:46658/query`
 
 // ./privateKey file contains a base64 encoded key generated by the command:
 // loom genkey -a publicKey -k privateKey
-// const privateKey = readFileSync('./privateKey', 'utf-8') // For Tencent cloud
-const privateKey = readFileSync('./private_key', 'utf-8') // For Ubuntu
+const privateKey = readFileSync(keyPath, 'utf-8')
 
 const loomTruffleProvider = new LoomTruffleProvider(chainId, writeUrl, readUrl, privateKey)
 
@@ -43,14 +48,14 @@ module.exports = {
   // to customize your Truffle configuration!
   migrations_directory: './migrations',
   networks: {
-    development: {
+    development: { // For windows only
       host: 'localhost',
       port: 7545,
       network_id: '*', // Match any network id
       gasPrice: 1,
       gas: 8000000,
     },
-    loom_dapp_chain: {
+    loom: {
       host: ipAddr,
       provider: loomTruffleProvider,
       network_id: '*',