Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve codespace secrets approach #1798

Merged
merged 5 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .devcontainer/auto-quick-setup/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,36 @@
{
"name": "theyworkforyou",
"secrets": {
"TWFY_VOTES_URL": {
"description": "URL to the TWFY Votes page"
},
"MAPIT_URL": {
"description": "URL to the MapIt API - defaults to mapit.mysociety.org."
},
"MAPIT_API_KEY": {
"description": "API key for the MapIt API - optional for small numbers of queries."
},
"DEMOCRACYCLUB_TOKEN": {
"description": "API key for the Democracy Club API - only for election postcode lookups."
},
"RECAPTCHA_SITE_KEY": {
"description": "Recaptcha site key. Can use v2 test keys from link.",
"documentationUrl": "https://developers.google.com/recaptcha/docs/faq#:~:text=hidden%3B%20%7D-,I%27d%20like%20to%20run%20automated%20tests%20with%20reCAPTCHA.%20What%20should%20I%20do%3F,-For%20reCAPTCHA%20v3"

},
"RECAPTCHA_SECRET": {
"description": "Recaptcha secret key. Can use v2 test keys from link.",
"documentationUrl": "https://developers.google.com/recaptcha/docs/faq#:~:text=hidden%3B%20%7D-,I%27d%20like%20to%20run%20automated%20tests%20with%20reCAPTCHA.%20What%20should%20I%20do%3F,-For%20reCAPTCHA%20v3"

},
"STRIPE_DONATE_PUBLIC_KEY": {
"description": "Stripe donate public key (test key). Only needed for donate page testing."
},
"STRIPE_DONATE_SECRET_KEY": {
"description": "Stripe donate secret key (test key). Only needed for donate page testing."
}

},
"dockerComposeFile": "../../docker-compose.yml",
"service": "twfy",
"workspaceFolder": "/twfy",
Expand Down
30 changes: 30 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,36 @@
{
"name": "theyworkforyou",
"secrets": {
"TWFY_VOTES_URL": {
"description": "URL to the TWFY Votes page"
},
"MAPIT_URL": {
"description": "URL to the MapIt API - defaults to mapit.mysociety.org"
},
"MAPIT_API_KEY": {
"description": "API key for the MapIt API - optional for small numbers of queries"
},
"DEMOCRACYCLUB_TOKEN": {
"description": "API key for the Democracy Club API - only for election postcode lookups."
},
"RECAPTCHA_SITE_KEY": {
"description": "Recaptcha site key. Can use v2 test keys from link.",
"documentationUrl": "https://developers.google.com/recaptcha/docs/faq#:~:text=hidden%3B%20%7D-,I%27d%20like%20to%20run%20automated%20tests%20with%20reCAPTCHA.%20What%20should%20I%20do%3F,-For%20reCAPTCHA%20v3"

},
"RECAPTCHA_SECRET": {
"description": "Recaptcha secret key. Can use v2 test keys from link.",
"documentationUrl": "https://developers.google.com/recaptcha/docs/faq#:~:text=hidden%3B%20%7D-,I%27d%20like%20to%20run%20automated%20tests%20with%20reCAPTCHA.%20What%20should%20I%20do%3F,-For%20reCAPTCHA%20v3"

},
"STRIPE_DONATE_PUBLIC_KEY": {
"description": "Stripe donate public key (test key). Only needed for donate page testing."
},
"STRIPE_DONATE_SECRET_KEY": {
"description": "Stripe donate secret key (test key). Only needed for donate page testing."
}

},
"dockerComposeFile": "../docker-compose.yml",
"service": "twfy",
"workspaceFolder": "/twfy",
Expand Down
7 changes: 7 additions & 0 deletions bin/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ sed -r \
-e 's!^(.*"OPTION_TWFY_DB_NAME", *)"[^"]*"!'"\\1'twfy'!" \
-e 's!^(.*"OPTION_TWFY_MEMCACHED_HOST", *)"[^"]*"!'"\\1'memcache'!" \
-e 's!^(.*"TWFY_VOTES_URL", *)"[^"]*"!'"\\1'$TWFY_VOTES_URL'!" \
-e 's!^(.*"OPTION_MAPIT_URL", *)"[^"]*"!'"\\1'$MAPIT_URL'!" \
-e 's!^(.*"OPTION_MAPIT_API_KEY", *)"[^"]*"!'"\\1'$MAPIT_API_KEY'!" \
-e 's!^(.*"OPTION_DEMOCRACYCLUB_TOKEN", *)"[^"]*"!'"\\1'$DEMOCRACYCLUB_TOKEN'!" \
-e 's!^(.*"OPTION_RECAPTCHA_SITE_KEY", *)"[^"]*"!'"\\1'$RECAPTCHA_SITE_KEY'!" \
-e 's!^(.*"OPTION_RECAPTCHA_SECRET", *)"[^"]*"!'"\\1'$RECAPTCHA_SECRET'!" \
-e 's!^(.*"STRIPE_DONATE_PUBLIC_KEY", *)"[^"]*"!'"\\1'$STRIPE_DONATE_PUBLIC_KEY'!" \
-e 's!^(.*"STRIPE_DONATE_SECRET_KEY", *)"[^"]*"!'"\\1'$STRIPE_DONATE_SECRET_KEY'!" \
-e 's!^(.*"BASEDIR", *)"[^"]*"!'"\\1'/twfy/www/docs'!" \
-e 's!^(.*"DOMAIN", *)"[^"]*"!'"\\1'localhost'!" \
-e 's!^(.*"COOKIEDOMAIN", *)"[^"]*"!'"\\1'localhost'!" \
Expand Down
2 changes: 2 additions & 0 deletions conf/general-example
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ define('OPTION_HEARFROMYOURMP_BASE_URL', '');
if (!defined('OPTION_MAPIT_URL')) {
define('OPTION_MAPIT_URL', '');
}

define('OPTION_MAPIT_API_KEY', '');
define('OPTION_DEMOCRACYCLUB_TOKEN', '');
define('OPTION_MAPIT_UPRN_LOOKUP', '');

Expand Down
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ services:
TWFY_TEST_DB_USER: twfy
TWFY_TEST_DB_PASS: password
TWFY_VOTES_URL: ${TWFY_VOTES_URL}
MAPIT_URL: ${MAPIT_URL:-https://mapit.mysociety.org/}
MAPIT_API_KEY: ${MAPIT_API_KEY:-}
DEMOCRACYCLUB_TOKEN: ${DEMOCRACYCLUB_TOKEN:-}
RECAPTCHA_SITE_KEY: ${RECAPTCHA_SITE_KEY:-}
RECAPTCHA_SECRET: ${RECAPTCHA_SECRET:-}
STRIPE_DONATE_PUBLIC_KEY: ${STRIPE_DONATE_PUBLIC_KEY:-}
STRIPE_DONATE_SECRET_KEY: ${STRIPE_DONATE_SECRET_KEY:-}
DEV_MODE: 'true'
WSL_IP:
ports:
Expand Down
Loading