Skip to content

Commit

Permalink
Use addressfinder key from ENV var
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitryrck committed Jul 19, 2021
1 parent 74f8466 commit a07a71d
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 1 deletion.
1 change: 1 addition & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
AUTH_NAME=secretary
AUTH_PASSWORD=password
SOCIETY_NAME=SampleSociety
ADDRESSFINDER_PUBLIC_KEY=xxx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Array.prototype.forEach.call(elements, function (addressElement) {
widget = new AddressFinder.Widget(
addressElement,
"PKWQ7XJH3GBUCLFMV49Y",
"<%= ENV["ADDRESSFINDER_PUBLIC_KEY"] %>",
'NZ',
{
address_params: {
Expand Down
2 changes: 2 additions & 0 deletions config/webpack/environment.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const { environment } = require('@rails/webpacker')
const erb = require('./loaders/erb')

environment.loaders.prepend('erb', erb)
module.exports = environment
11 changes: 11 additions & 0 deletions config/webpack/loaders/erb.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
test: /\.erb$/,
enforce: 'pre',
exclude: /node_modules/,
use: [{
loader: 'rails-erb-loader',
options: {
runner: (/^win/.test(process.platform) ? 'ruby ' : '') + 'bin/rails runner'
}
}]
}
1 change: 1 addition & 0 deletions config/webpacker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ default: &default
- .woff2

extensions:
- .erb
- .mjs
- .js
- .sass
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"dependencies": {
"@rails/webpacker": "5.4.0",
"rails-erb-loader": "^5.5.2",
"webpack": "^4.46.0",
"webpack-cli": "^3.3.12"
},
Expand Down
13 changes: 13 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3863,6 +3863,11 @@ lodash.debounce@^4.0.8:
resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
integrity sha1-gteb/zCmfEAF/9XiUVMArZyk168=

lodash.defaults@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-4.2.0.tgz#d09178716ffea4dde9e5fb7b37f6f0802274580c"
integrity sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw=

lodash.get@^4.0:
version "4.4.2"
resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99"
Expand Down Expand Up @@ -5448,6 +5453,14 @@ querystringify@^2.1.1:
resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6"
integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==

rails-erb-loader@^5.5.2:
version "5.5.2"
resolved "https://registry.yarnpkg.com/rails-erb-loader/-/rails-erb-loader-5.5.2.tgz#db3fa8ac89600f09d179a1a70a2ca18c592576ea"
integrity sha512-cjQH9SuSvRPhnWkvjmmAW/S4AFVDfAtYnQO4XpKJ8xpRdZayT73iXoE+IPc3VzN03noZXhVmyvsCvKvHj4LY6w==
dependencies:
loader-utils "^1.1.0"
lodash.defaults "^4.2.0"

randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5, randombytes@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a"
Expand Down

0 comments on commit a07a71d

Please sign in to comment.