File tree Expand file tree Collapse file tree 4 files changed +18
-3
lines changed Expand file tree Collapse file tree 4 files changed +18
-3
lines changed Original file line number Diff line number Diff line change 33 */
44
55var joi = require ( 'joi' ) ;
6+ var wtpConfig = require ( 'config' ) . get ( 'WE_THE_PEOPLE' ) ;
7+
8+ var petitionIdType = joi . string ( ) ;
9+ if ( wtpConfig . get ( 'WHITELIST_PETITIONS' ) ) {
10+ petitionIdType = petitionIdType . valid (
11+ wtpConfig . get ( 'WHITELISTED_PETITIONS' )
12+ ) ;
13+ }
614
715var signaturePOSTSchema = joi . object ( ) . keys ( {
816 firstName : joi . string ( ) . max ( 50 ) . required ( ) ,
917 lastName : joi . string ( ) . max ( 50 ) . required ( ) ,
1018 email : joi . string ( ) . email ( ) . required ( ) ,
19+ petitionId : petitionIdType . required ( ) ,
1120 subscribeToEmails : joi . string ( )
1221} ) ;
1322
Original file line number Diff line number Diff line change 1717 "WE_THE_PEOPLE" : {
1818 "API_KEY" : " " ,
1919 "API_URL" : " " ,
20- "RATE_LIMIT" : 1000
20+ "RATE_LIMIT" : 1000 ,
21+ "WHITELIST_PETITIONS" : true
2122 },
2223
2324 "REDIS" : {
Original file line number Diff line number Diff line change 22
33 "WE_THE_PEOPLE" : {
44 "API_KEY" : " " ,
5- "API_URL" : " http://sandbox.api.whitehouse.gov/v1"
5+ "API_URL" : " http://sandbox.api.whitehouse.gov/v1" ,
6+ "WHITELISTED_PETITIONS" : [
7+ " 4e7b218a4bd504c17a000001" ,
8+ " 4e7b21632ee8d04577000000"
9+ ]
610 }
711
812}
Original file line number Diff line number Diff line change 88
99 "WE_THE_PEOPLE" : {
1010 "API_KEY" : " " ,
11- "API_URL" : " https://api.whitehouse.gov/v1"
11+ "API_URL" : " https://api.whitehouse.gov/v1" ,
12+ "WHITELISTED_PETITIONS" : []
1213 }
1314
1415}
You can’t perform that action at this time.
0 commit comments