@govuk-pay/cli 0.0.21 → 0.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@govuk-pay/cli",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "description": "GOV.UK Pay Command Line Interface",
5
5
  "bin": {
6
6
  "pay": "bin/cli.js",
package/readme.md CHANGED
@@ -40,6 +40,21 @@ use the command `legacy`, for example:
40
40
 
41
41
  Please add an issue any time you need to fall back on legacy behaviour so we can improve the typescript implementation.
42
42
 
43
+ ### Config files
44
+
45
+ Config files needed by the pay cli will go in `$HOME/.pay-cli"
46
+
47
+ #### Pay Local Config Files
48
+
49
+ You can override environment variables set in the the .env files in [the pay local services local config directory](https://github.com/alphagov/pay-cli/tree/main/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/services` for
50
+ specific containers by placing files in `$HOME/.pay-cli/local/environment-overrides/<app_name>.env`.
51
+
52
+ For example to override an environment variable for connector which was set in [connector.env](https://github.com/alphagov/pay-cli/blob/main/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/services/connector.env)
53
+ you could create the file `$HOME/.pay-cli/local/environment-overrides/connector.env`
54
+
55
+ Note: This will only override variables set in the .env files, it will not override any variables which get declared in an `environment` configuration option in the generated docker-compose files. These are generated from the
56
+ [docker-compose.erb](https://github.com/alphagov/pay-cli/blob/main/resources/legacy-ruby-cli/lib/pay_cli/commands/local/files/docker-compose.erb#L5) template.
57
+
43
58
  ## Vulnerability Disclosure
44
59
 
45
60
  GOV.UK Pay aims to stay secure for everyone. If you are a security researcher and have discovered a security vulnerability in this code, we appreciate your help in disclosing it to us in a responsible manner. Please refer to our [vulnerability disclosure policy](https://www.gov.uk/help/report-vulnerability) and our [security.txt](https://vdp.cabinetoffice.gov.uk/.well-known/security.txt) file for details.
@@ -85,7 +85,7 @@ module PayCLI::Commands::Local::AppClient
85
85
 
86
86
  def self.create_service()
87
87
  service_data = {
88
- service_name: 'My service'
88
+ service_name: {en: 'My service', cy: 'Welsh name for My service'}
89
89
  }
90
90
 
91
91
  post("#{base_url 'adminusers'}/v1/api/services", service_data)
@@ -122,6 +122,7 @@ selfservice:
122
122
  - admin
123
123
  - endtoend
124
124
  - webhooks
125
+ - toolbox
125
126
  products-ui:
126
127
  name: products-ui
127
128
  proxy: true
@@ -3,6 +3,7 @@ services:
3
3
  adminusers_db:
4
4
  image: postgres:15.6
5
5
  environment:
6
+ - BIND_HOST=0.0.0.0
6
7
  - POSTGRES_PASSWORD=mysecretpassword
7
8
  mem_limit: 250M
8
9
  logging:
@@ -23,6 +24,7 @@ services:
23
24
  connector_db:
24
25
  image: postgres:15.6
25
26
  environment:
27
+ - BIND_HOST=0.0.0.0
26
28
  - POSTGRES_PASSWORD=mysecretpassword
27
29
  mem_limit: 250M
28
30
  logging:
@@ -43,6 +45,7 @@ services:
43
45
  publicauth_db:
44
46
  image: postgres:15.6
45
47
  environment:
48
+ - BIND_HOST=0.0.0.0
46
49
  - POSTGRES_PASSWORD=mysecretpassword
47
50
  mem_limit: 250M
48
51
  logging:
@@ -63,6 +66,7 @@ services:
63
66
  products_db:
64
67
  image: postgres:15.6
65
68
  environment:
69
+ - BIND_HOST=0.0.0.0
66
70
  - POSTGRES_PASSWORD=mysecretpassword
67
71
  mem_limit: 250M
68
72
  logging:
@@ -83,6 +87,7 @@ services:
83
87
  ledger_db:
84
88
  image: postgres:15.6
85
89
  environment:
90
+ - BIND_HOST=0.0.0.0
86
91
  - POSTGRES_PASSWORD=mysecretpassword
87
92
  mem_limit: 250M
88
93
  logging:
@@ -103,6 +108,7 @@ services:
103
108
  webhooks_db:
104
109
  image: postgres:15.6
105
110
  environment:
111
+ - BIND_HOST=0.0.0.0
106
112
  - POSTGRES_PASSWORD=mysecretpassword
107
113
  mem_limit: 250M
108
114
  logging:
@@ -132,6 +138,7 @@ services:
132
138
  - services/java_app.env
133
139
  - services/adminusers.env
134
140
  environment:
141
+ - BIND_HOST=0.0.0.0
135
142
  - RUN_MIGRATION=true
136
143
  - RUN_APP=true
137
144
  - PORT=9700
@@ -194,6 +201,7 @@ services:
194
201
  - services/java_app.env
195
202
  - services/connector.env
196
203
  environment:
204
+ - BIND_HOST=0.0.0.0
197
205
  - RUN_MIGRATION=true
198
206
  - RUN_APP=true
199
207
  - PORT=9300
@@ -255,6 +263,7 @@ services:
255
263
  - services/java_app.env
256
264
  - services/cardid.env
257
265
  environment:
266
+ - BIND_HOST=0.0.0.0
258
267
  - RUN_MIGRATION=true
259
268
  - RUN_APP=true
260
269
  - PORT=9900
@@ -303,6 +312,7 @@ services:
303
312
  - services/java_app.env
304
313
  - services/publicauth.env
305
314
  environment:
315
+ - BIND_HOST=0.0.0.0
306
316
  - RUN_MIGRATION=true
307
317
  - RUN_APP=true
308
318
  - PORT=9600
@@ -352,6 +362,7 @@ services:
352
362
  - services/java_app.env
353
363
  - services/publicapi.env
354
364
  environment:
365
+ - BIND_HOST=0.0.0.0
355
366
  - RUN_MIGRATION=true
356
367
  - RUN_APP=true
357
368
  - PORT=9100
@@ -401,6 +412,7 @@ services:
401
412
  - services/java_app.env
402
413
  - services/products.env
403
414
  environment:
415
+ - BIND_HOST=0.0.0.0
404
416
  - RUN_MIGRATION=true
405
417
  - RUN_APP=true
406
418
  - PORT=18000
@@ -454,6 +466,7 @@ services:
454
466
  - services/java_app.env
455
467
  - services/ledger.env
456
468
  environment:
469
+ - BIND_HOST=0.0.0.0
457
470
  - RUN_MIGRATION=true
458
471
  - RUN_APP=true
459
472
  - PORT=10700
@@ -514,8 +527,9 @@ services:
514
527
  networks:
515
528
  - pay_local_mimic_aws_vpc
516
529
 
530
+
517
531
  webhooks:
518
- image: governmentdigitalservice/pay-webhooks:latest-master
532
+ image: governmentdigitalservice/pay-webhooks:local
519
533
 
520
534
  depends_on:
521
535
  webhooks_db:
@@ -525,6 +539,7 @@ services:
525
539
  - services/java_app.env
526
540
  - services/webhooks.env
527
541
  environment:
542
+ - BIND_HOST=192.168.0.111
528
543
  - RUN_MIGRATION=true
529
544
  - RUN_APP=true
530
545
  - PORT=10800
@@ -566,23 +581,25 @@ services:
566
581
  - PRODUCTS-UI_URL=http://localhost:10400
567
582
  - STUBS_URL=http://localhost:3030
568
583
  - TOOLBOX_URL=http://localhost:3040
584
+ working_dir: '/app'
569
585
  mem_limit: 2G
586
+ user: root
570
587
  logging:
571
588
  driver: "json-file"
572
589
  ports:
573
- - "10800:10800"
574
- - "10801:10801"
590
+ - "10800:10800"
591
+ - "10801:10801"
575
592
  container_name: webhooks
576
593
  networks:
577
594
  - pay_local_mimic_aws_vpc
578
595
 
579
596
 
580
-
581
597
  frontend:
582
598
  image: governmentdigitalservice/pay-frontend:latest-master
583
599
 
584
600
  env_file: services/frontend.env
585
601
  environment:
602
+ - BIND_HOST=0.0.0.0
586
603
  - SECURE_COOKIE_OFF=true
587
604
  - RUN_APP=true
588
605
  - DISABLE_INTERNAL_HTTPS=true
@@ -625,6 +642,7 @@ services:
625
642
 
626
643
  env_file: services/selfservice.env
627
644
  environment:
645
+ - BIND_HOST=0.0.0.0
628
646
  - SECURE_COOKIE_OFF=true
629
647
  - RUN_APP=true
630
648
  - DISABLE_INTERNAL_HTTPS=true
@@ -667,6 +685,7 @@ services:
667
685
 
668
686
  env_file: services/products-ui.env
669
687
  environment:
688
+ - BIND_HOST=0.0.0.0
670
689
  - SECURE_COOKIE_OFF=true
671
690
  - RUN_APP=true
672
691
  - DISABLE_INTERNAL_HTTPS=true
@@ -709,6 +728,7 @@ services:
709
728
 
710
729
  env_file: services/stubs.env
711
730
  environment:
731
+ - BIND_HOST=0.0.0.0
712
732
  - SECURE_COOKIE_OFF=true
713
733
  - RUN_APP=true
714
734
  - DISABLE_INTERNAL_HTTPS=true
@@ -751,6 +771,7 @@ services:
751
771
 
752
772
  env_file: services/toolbox.env
753
773
  environment:
774
+ - BIND_HOST=0.0.0.0
754
775
  - SECURE_COOKIE_OFF=true
755
776
  - RUN_APP=true
756
777
  - DISABLE_INTERNAL_HTTPS=true
@@ -3,6 +3,7 @@ services:
3
3
  <%= db[:name] %>:
4
4
  image: postgres:15.6
5
5
  environment:
6
+ - BIND_HOST=0.0.0.0
6
7
  - POSTGRES_PASSWORD=mysecretpassword
7
8
  mem_limit: 250M
8
9
  logging:
@@ -31,7 +32,11 @@ services:
31
32
  env_file:
32
33
  - services/java_app.env
33
34
  - services/<%= app[:name] %>.env
35
+ <% if File.exist?(File.join(Dir.home, ".pay-cli", "local", "environment-overrides", "#{app[:name]}.env")) %>
36
+ - <%= File.join(Dir.home, ".pay-cli", "local", "environment-overrides", "#{app[:name]}.env") %>
37
+ <% end %>
34
38
  environment:
39
+ - BIND_HOST=0.0.0.0
35
40
  - RUN_MIGRATION=true
36
41
  - RUN_APP=true
37
42
  - PORT=<%= app[:port] %>
@@ -114,7 +119,11 @@ services:
114
119
  env_file:
115
120
  - services/java_app.env
116
121
  - services/<%= app[:name] %>.env
122
+ <% if File.exist?(File.join(Dir.home, ".pay-cli", "local", "environment-overrides", "#{app[:name]}.env")) %>
123
+ - <%= File.join(Dir.home, ".pay-cli", "local", "environment-overrides", "#{app[:name]}.env") %>
124
+ <% end %>
117
125
  environment:
126
+ - BIND_HOST=0.0.0.0
118
127
  - RUN_MIGRATION=true
119
128
  - RUN_APP=true
120
129
  - PORT=<%= app[:port] %>
@@ -196,8 +205,13 @@ services:
196
205
  <%= app[:name] %>_db:
197
206
  condition: service_healthy
198
207
  <% end %>
199
- env_file: services/<%= app[:name] %>.env
208
+ env_file:
209
+ - services/<%= app[:name] %>.env
210
+ <% if File.exist?(File.join(Dir.home, ".pay-cli", "local", "environment-overrides", "#{app[:name]}.env")) %>
211
+ - <%= File.join(Dir.home, ".pay-cli", "local", "environment-overrides", "#{app[:name]}.env") %>
212
+ <% end %>
200
213
  environment:
214
+ - BIND_HOST=0.0.0.0
201
215
  - SECURE_COOKIE_OFF=true
202
216
  - RUN_APP=true
203
217
  - DISABLE_INTERNAL_HTTPS=true
@@ -250,12 +264,17 @@ services:
250
264
  <%= app[:name] %>_db:
251
265
  condition: service_healthy
252
266
  <% end %>
253
- env_file: services/<%= app[:name] %>.env
267
+ env_file:
268
+ - services/<%= app[:name] %>.env
269
+ <% if File.exist?(File.join(Dir.home, ".pay-cli", "local", "environment-overrides", "#{app[:name]}.env")) %>
270
+ - <%= File.join(Dir.home, ".pay-cli", "local", "environment-overrides", "#{app[:name]}.env") %>
271
+ <% end %>
254
272
  <% if @mount_local_node_apps %>
255
273
  volumes:
256
274
  - "$WORKSPACE/pay-<%= app[:name] %>:/app"
257
275
  <% end %>
258
276
  environment:
277
+ - BIND_HOST=0.0.0.0
259
278
  - SECURE_COOKIE_OFF=true
260
279
  - RUN_APP=true
261
280
  - DISABLE_APPMETRICS=true
@@ -306,6 +325,7 @@ services:
306
325
  <%= app[:name] %>:
307
326
  image: governmentdigitalservice/pay-docker-nginx-proxy:latest-master
308
327
  environment:
328
+ - BIND_HOST=0.0.0.0
309
329
  - PROXY_SERVICE_HOST=http://<%= app[:proxy_host] %>
310
330
  - PROXY_SERVICE_PORT=<%= app[:proxy_port] %>
311
331
  - HTTPS_LISTEN_PORT=<%= app[:port] %>
@@ -89,7 +89,6 @@ class PayCLI::Commands::Local < Thor
89
89
  threads = []
90
90
  (@local_java_apps + @local_node_apps).each do |app|
91
91
  check_for_local_repo("pay-#{app[:name]}")
92
- check_cardid_data if app[:name] == 'cardid'
93
92
 
94
93
  threads << Thread.new do
95
94
  ws_dir = Pathname.new(ENV['WORKSPACE']).join("pay-#{app[:name]}")
@@ -406,16 +405,6 @@ class PayCLI::Commands::Local < Thor
406
405
  end
407
406
  end
408
407
 
409
- def check_cardid_data
410
- cardid_path = File.join(ENV['WORKSPACE'], 'pay-cardid')
411
-
412
- unless Dir.exist?(File.join(cardid_path, 'data', 'sources'))
413
- abort '❌ pay-cardid does not have the cardid-data submodule updated. '\
414
- 'Run `git submodule update --init && git -C data pull origin master` in '\
415
- "#{cardid_path} to init and update the cardid-data submodule"
416
- end
417
- end
418
-
419
408
  def npm_install(repo_name)
420
409
  repo_path = File.join(ENV['WORKSPACE'], repo_name)
421
410
  `cd #{repo_path} && npm install >>/dev/null 2>&1`