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

DefaultAppBootstrapper to create worker account (wip) #681

Open
wants to merge 1 commit into
base: bootstrap-worker
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import static org.sagebionetworks.bridge.BridgeConstants.TEST_USER_GROUP;
import static org.sagebionetworks.bridge.Roles.ADMIN;
import static org.sagebionetworks.bridge.Roles.SUPERADMIN;
import static org.sagebionetworks.bridge.Roles.WORKER;
import static org.sagebionetworks.bridge.config.Environment.PROD;
import static org.sagebionetworks.bridge.models.accounts.SharingScope.NO_SHARING;

Expand Down Expand Up @@ -134,6 +135,17 @@ public void onApplicationEvent(ContextRefreshedEvent event) {
if (bootstrapUserConfigured && bridgeConfig.getEnvironment() != Environment.PROD) {
createAccount(shared, admin);
}

// Make worker account.
String workerEmail = bridgeConfig.get("worker.email");
String workerPassword = bridgeConfig.get("worker.password");
if (workerEmail != null && workerPassword != null) {
Account worker = Account.create();
worker.setEmail(workerEmail);
worker.setPassword(workerPassword);
worker.setRoles(Sets.newHashSet(WORKER));
createAccount(app, worker);
}
}

private App createApp(String appId, String name, Consumer<App> consumer) {
Expand Down
12 changes: 7 additions & 5 deletions src/main/resources/BridgeServer2.conf
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,14 @@ usersigned.consents.bucket = org-sagebridge-usersigned-consents-${bucket.suffix}
prod.usersigned.consents.bucket = bridgepf-prod-awss3usersignedconsentsdownloadbuck-1slz1bcz0mls7

# Bootstrap user for integration tests (will only be used when first initializing your database).
# This should match the synapse.test.user.* credentials set for your integration test properties
# This should match the synapse.test.user.* credentials set for your integration test properties
# in your bridge-sdk-test.properties file.
admin.email = dummy-value
admin.password = dummy-value
admin.synapse.user.id = 3336429
prod.admin.synapse.user.id = 3399057
worker.email = dummy-value
worker.password = dummy-value

synapse.oauth.url = https://repo-dev.dev.sagebase.org/auth/v1/oauth2/token
prod.synapse.oauth.url = https://repo-prod.prod.sagebase.org/auth/v1/oauth2/token
Expand All @@ -199,7 +201,7 @@ gbf.order.returns.url = https://www.gbfmedical.com/oap/api/returns
gbf.ship.confirmation.url = https://www.gbfmedical.com/oap/api/confirm
gbf.api.key = dummy-value

# Schedule timeline metadata records batch persist. Values above 100 do not seem to
# Schedule timeline metadata records batch persist. Values above 100 do not seem to
# improve performance, but values under 100 start to degrade it a bit.
schedule.batch.size = 100

Expand Down Expand Up @@ -237,9 +239,9 @@ participantroster.bucket = org-sagebridge-participantroster-${bucket.suffix}
# Public documents folder
docs.bucket = docs${host.postfix}

# In production, the bucket name and domain name are the same because we can configure
# the domain name in Route 53. In local, development, and staging environments, we do
# not (can not?) configure DNS entries because they are in a separate AWS account.
# In production, the bucket name and domain name are the same because we can configure
# the domain name in Route 53. In local, development, and staging environments, we do
# not (can not?) configure DNS entries because they are in a separate AWS account.
# So we use the full S3 website hosting URL.
docs.website.url = ${docs.bucket}
local.docs.website.url = docs-${bridge.user}.sagebridge.org.s3-website-us-east-1.amazonaws.com
Expand Down