Browse Source

[+Jordi] #163 - Add environment handling for external devices in petitions app

Elena Cristina Raffay Iglesias 1 year ago
parent
commit
d83bcb1898

+ 1 - 1
apps/atlantis/src/client/components/Attribute.jsx

@@ -34,7 +34,7 @@ const Attribute = () => (
34 34
     <Paragraph>By clicking the button below, you are agreeing to request a verification
35 35
      of Atlantis residency from Atlantis City Council.</Paragraph>
36 36
     <Button>
37
-      <Link href="exp://REPLACE_ME/?credential=0123456789">Request Attribute</Link>
37
+      <Link href="exp://REPLACE_ME&credential=0123456789">Request Attribute</Link>
38 38
     </Button>
39 39
   </Container>
40 40
 );

+ 1 - 1
apps/petitions/decode-app/project.clj

@@ -26,7 +26,7 @@
26 26
   :sass {:src "resources/stylesheets/"
27 27
          :output-directory "resources/public/stylesheets/"
28 28
          :command :sass}
29
-  :ring {:handler decode-app.handler/app  :port 3040}
29
+  :ring {:handler decode-app.handler/app  :port 3040 :host "0.0.0.0"}
30 30
   :profiles {:dev {:dependencies [[javax.servlet/servlet-api "2.5"]
31 31
                                   [ring/ring-mock "0.3.0"]
32 32
                                   [danlentz/clj-uuid "0.1.7"]]}})

+ 1 - 1
apps/petitions/petitions-app/config.json

@@ -1,7 +1,7 @@
1 1
 {
2 2
   "development": {
3 3
     "api": "http://localhost:3040",
4
-    "expoLink": "exp://localhost:19000?release-channel=development"
4
+    "expoLink": "exp://localhost:19000?"
5 5
   },
6 6
   "production": {
7 7
     "api" : "http://ec2-34-253-207-49.eu-west-1.compute.amazonaws.com",

+ 11 - 2
apps/petitions/petitions-app/webpack.config.js

@@ -5,6 +5,10 @@ const CopyWebpackPlugin = require('copy-webpack-plugin');
5 5
 const config = require('./config.json');
6 6
 
7 7
 const getAPIEndpoint = () => {
8
+  if (process.env.IP) {
9
+    return config.development.api.replace('localhost', process.env.IP);
10
+  }
11
+
8 12
   switch (process.env.NODE_ENV) {
9 13
     case 'production':
10 14
       return config.production.api;
@@ -14,6 +18,9 @@ const getAPIEndpoint = () => {
14 18
 };
15 19
 
16 20
 const getExpoLink = () => {
21
+  if (process.env.IP) {
22
+    return config.development.expoLink.replace('localhost', process.env.IP);
23
+  }
17 24
   switch (process.env.NODE_ENV) {
18 25
     case 'production':
19 26
       return config.production.expoLink;
@@ -38,6 +45,8 @@ module.exports = {
38 45
     historyApiFallback: {
39 46
       index: 'index.html',
40 47
     },
48
+    host: '0.0.0.0',
49
+    port: 8080,
41 50
   },
42 51
   plugins: [
43 52
     new HtmlWebpackPlugin({
@@ -48,8 +57,8 @@ module.exports = {
48 57
       expoLink: JSON.stringify(getExpoLink()),
49 58
     }),
50 59
     new CopyWebpackPlugin([
51
-        // {output}/to/file.txt
52
-        { from: './src/assets', to: './assets' }])],
60
+      // {output}/to/file.txt
61
+      { from: './src/assets', to: './assets' }])],
53 62
   resolve: {
54 63
     extensions: ['.js', '.json', '.jsx'],
55 64
   },