Skip to content

Commit 4d5914f

Browse files
committed
feat: update The S3
1 parent c68e8c6 commit 4d5914f

File tree

2 files changed

+95
-19
lines changed

2 files changed

+95
-19
lines changed

imageroot/actions/configure-module/10configure_environment_vars

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,23 @@ import agent
1313
# If parsing fails, output everything to stderr
1414
data = json.load(sys.stdin)
1515

16-
#This is specific to you module, so you need to change it accordingly.
16+
# This is specific to you module, so you need to change it accordingly.
1717
# Upper case to set environment variable and minor case to read from stdin
1818

1919
# Email Settings
2020
# Add EMAIL SETTINGS
2121
rdb = agent.redis_connect(use_replica=True)
2222
smtp_settings = agent.get_smarthost_settings(rdb)
23-
ALLOWED_HOSTS = data.get('host')
24-
SMTP_HOST=smtp_settings['host']
25-
SMTP_PORT=smtp_settings['port']
26-
SMTP_USER=smtp_settings['username']
27-
SMTP_PASSWORD=smtp_settings['password']
28-
SMTP_ENCRYPTION=smtp_settings['encrypt_smtp']
29-
SMTP_TLSVERIFY='True' if smtp_settings['tls_verify'] else 'False'
30-
SMTP_SSLVERIFY='False' if smtp_settings['tls_verify'] else 'True'
31-
ALLOW_GOOGLE_SSO = data.get('allow_google_sso', False)
23+
ALLOWED_HOSTS = data.get("host")
24+
SMTP_HOST = smtp_settings["host"]
25+
SMTP_PORT = smtp_settings["port"]
26+
SMTP_USER = smtp_settings["username"]
27+
SMTP_PASSWORD = smtp_settings["password"]
28+
SMTP_ENCRYPTION = smtp_settings["encrypt_smtp"]
29+
SMTP_TLSVERIFY = "True" if smtp_settings["tls_verify"] else "False"
30+
SMTP_SSLVERIFY = "False" if smtp_settings["tls_verify"] else "True"
31+
ALLOW_GOOGLE_SSO = data.get("allow_google_sso", False)
32+
DEFAULT_EMAIL_FROM = SMTP_USER
3233

3334

3435
chief_config = {
@@ -40,15 +41,20 @@ chief_config = {
4041
"EMAIL_USE_SSL": not SMTP_ENCRYPTION,
4142
"ALLOWED_HOSTS": ALLOWED_HOSTS,
4243
"ALLOW_GOOGLE_SSO": ALLOW_GOOGLE_SSO,
43-
"GOOGLE_SSO_CLIENT_ID": data.get('google_sso_client_id', ''),
44-
"GOOGLE_SSO_SECRET": data.get('google_sso_secret', ''),
45-
"SOCIALACCOUNT_PROVIDERS": json.dumps(data.get('socialaccount_providers', {})),
46-
"SSO_AUTO_CREATE_USER": data.get('sso_auto_create_user', True),
47-
"OIDC_ROLE_NEW_HIRE_PATTERN": data.get('oidc_role_new_hire_pattern', ''),
48-
"OIDC_ROLE_ADMIN_PATTERN": data.get('oidc_role_admin_pattern', ''),
49-
"OIDC_ROLE_MANAGER_PATTERN": data.get('oidc_role_manager_pattern', ''),
50-
"OIDC_ROLE_PATH_IN_RETURN": data.get('oidc_role_path_in_return', 'groups'),
51-
"ALLAUTH_PROVIDERS": data.get('allauth_providers', ''),
44+
"GOOGLE_SSO_CLIENT_ID": data.get("google_sso_client_id", ""),
45+
"GOOGLE_SSO_SECRET": data.get("google_sso_secret", ""),
46+
"SOCIALACCOUNT_PROVIDERS": json.dumps(data.get("socialaccount_providers", {})),
47+
"SSO_AUTO_CREATE_USER": data.get("sso_auto_create_user", True),
48+
"OIDC_ROLE_NEW_HIRE_PATTERN": data.get("oidc_role_new_hire_pattern", ""),
49+
"OIDC_ROLE_ADMIN_PATTERN": data.get("oidc_role_admin_pattern", ""),
50+
"OIDC_ROLE_MANAGER_PATTERN": data.get("oidc_role_manager_pattern", ""),
51+
"OIDC_ROLE_PATH_IN_RETURN": data.get("oidc_role_path_in_return", "groups"),
52+
"ALLAUTH_PROVIDERS": data.get("allauth_providers", ""),
53+
"AWS_S3_ENDPOINT_URL": data.get("aws_s3_endpoint_url", ""),
54+
"AWS_ACCESS_KEY_ID": data.get("aws_access_key_id", ""),
55+
"AWS_SECRET_ACCESS_KEY": data.get("aws_secret_access_key", ""),
56+
"AWS_STORAGE_BUCKET_NAME": data.get("aws_storage_bucket_name", ""),
57+
"AWS_DEFAULT_REGION": data.get("aws_default_region", ""),
5258
}
5359

5460
agent.write_envfile("chief.env", chief_config)

ui/src/views/Settings.vue

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,56 @@
164164
ref="allauthProviders"
165165
>
166166
</cv-text-input>
167+
<cv-text-input
168+
:label="$t('settings.aws_s3_endpoint_url')"
169+
placeholder="https://s3.eu-west-1.amazonaws.com"
170+
v-model.trim="awsS3EndpointUrl"
171+
class="mg-bottom"
172+
:invalid-message="$t(error.aws_s3_endpoint_url)"
173+
:disabled="loading.getConfiguration || loading.configureModule"
174+
ref="awsS3EndpointUrl"
175+
>
176+
</cv-text-input>
177+
<cv-text-input
178+
:label="$t('settings.aws_access_key_id')"
179+
placeholder="AKIAXXXXXXXX"
180+
v-model.trim="awsAccessKeyId"
181+
class="mg-bottom"
182+
:invalid-message="$t(error.aws_access_key_id)"
183+
:disabled="loading.getConfiguration || loading.configureModule"
184+
ref="awsAccessKeyId"
185+
>
186+
</cv-text-input>
187+
<cv-text-input
188+
:label="$t('settings.aws_secret_access_key')"
189+
placeholder="XXXXXXXXXXXXX"
190+
v-model.trim="awsSecretAccessKey"
191+
class="mg-bottom"
192+
:invalid-message="$t(error.aws_secret_access_key)"
193+
:disabled="loading.getConfiguration || loading.configureModule"
194+
ref="awsSecretAccessKey"
195+
>
196+
</cv-text-input>
197+
<cv-text-input
198+
:label="$t('settings.aws_storage_bucket_name')"
199+
placeholder="bucket-name"
200+
v-model.trim="awsStorageBucketName"
201+
class="mg-bottom"
202+
:invalid-message="$t(error.aws_storage_bucket_name)"
203+
:disabled="loading.getConfiguration || loading.configureModule"
204+
ref="awsStorageBucketName"
205+
>
206+
</cv-text-input>
207+
<cv-text-input
208+
:label="$t('settings.aws_default_region')"
209+
placeholder="eu-west-1"
210+
v-model.trim="awsDefaultRegion"
211+
class="mg-bottom"
212+
:invalid-message="$t(error.aws_default_region)"
213+
:disabled="loading.getConfiguration || loading.configureModule"
214+
ref="awsDefaultRegion"
215+
>
216+
</cv-text-input>
167217
</template>
168218
</cv-accordion-item>
169219
</cv-accordion>
@@ -232,6 +282,11 @@ export default {
232282
oidcRoleManagerPattern: "",
233283
oidcRolePathInReturn: "groups",
234284
allauthProviders: "",
285+
awsS3EndpointUrl: "",
286+
awsAccessKeyId: "",
287+
awsSecretAccessKey: "",
288+
awsStorageBucketName: "",
289+
awsDefaultRegion: "",
235290
loading: {
236291
getConfiguration: false,
237292
configureModule: false,
@@ -251,6 +306,11 @@ export default {
251306
oidc_role_manager_pattern: "",
252307
oidc_role_path_in_return: "",
253308
allauth_providers: "",
309+
aws_s3_endpoint_url: "",
310+
aws_access_key_id: "",
311+
aws_secret_access_key: "",
312+
aws_storage_bucket_name: "",
313+
aws_default_region: "",
254314
},
255315
};
256316
},
@@ -327,6 +387,11 @@ export default {
327387
this.oidcRoleManagerPattern = config.oidc_role_manager_pattern;
328388
this.oidcRolePathInReturn = config.oidc_role_path_in_return;
329389
this.allauthProviders = config.allauth_providers;
390+
this.awsS3EndpointUrl = config.aws_s3_endpoint_url;
391+
this.awsAccessKeyId = config.aws_access_key_id;
392+
this.awsSecretAccessKey = config.aws_secret_access_key;
393+
this.awsStorageBucketName = config.aws_storage_bucket_name;
394+
this.awsDefaultRegion = config.aws_default_region;
330395
331396
this.loading.getConfiguration = false;
332397
this.focusElement("host");
@@ -405,6 +470,11 @@ export default {
405470
oidc_role_manager_pattern: this.oidcRoleManagerPattern,
406471
oidc_role_path_in_return: this.oidcRolePathInReturn,
407472
allauth_providers: this.allauthProviders,
473+
aws_s3_endpoint_url: this.awsS3EndpointUrl,
474+
aws_access_key_id: this.awsAccessKeyId,
475+
aws_secret_access_key: this.awsSecretAccessKey,
476+
aws_storage_bucket_name: this.awsStorageBucketName,
477+
aws_default_region: this.awsDefaultRegion,
408478
},
409479
extra: {
410480
title: this.$t("settings.instance_configuration", {

0 commit comments

Comments
 (0)