generated from geniusdynamics/ns8-kickstart-postgresql
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Next Config in 10configure_next_config_vars
- Loading branch information
Showing
1 changed file
with
116 additions
and
0 deletions.
There are no files selected for viewing
116 changes: 116 additions & 0 deletions
116
imageroot/actions/configure-module/10configure_next_config_vars
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# | ||
# Copyright (C) 2022 Nethesis S.r.l. | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
# | ||
|
||
import json | ||
import sys | ||
import agent | ||
import secrets | ||
|
||
# Try to parse the stdin as JSON. | ||
# If parsing fails, output everything to stderr | ||
data = json.load(sys.stdin) | ||
|
||
# Generate Random Secret | ||
random_key = secrets.token_hex(16) | ||
|
||
SECRET = data.get("NEXTAUTH_SECRET",random_key) | ||
host = data.get("host") | ||
|
||
|
||
NEXTAUTH_URL = data.get("NEXTAUTH_URL", host) | ||
NEXTAUTH_SECRET = data.get("NEXTAUTH_SECRET", SECRET) | ||
|
||
NEXT_PRIVATE_ENCRYPTION_KEY = data.get("NEXT_PRIVATE_ENCRYPTION_KEY", secrets.token_hex(32)) | ||
NEXT_PRIVATE_ENCRYPTION_SECONDARY_KEY = data.get("NEXT_PRIVATE_ENCRYPTION_SECONDARY_KEY", secrets.token_hex(32)) | ||
|
||
NEXT_PRIVATE_GOOGLE_CLIENT_ID = data.get("NEXT_PRIVATE_GOOGLE_CLIENT_ID") | ||
NEXT_PRIVATE_GOOGLE_CLIENT_SECRET = data.get("NEXT_PRIVATE_GOOGLE_CLIENT_SECRET") | ||
NEXT_PRIVATE_SIGNING_TRANSPORT = data.get("NEXT_PRIVATE_SIGNING_TRANSPORT", "local") | ||
NEXT_PUBLIC_WEBAPP_URL = data.get("NEXT_PUBLIC_WEBAPP_URL", host) | ||
NEXT_PUBLIC_MARKETING_URL = data.get("NEXT_PUBLIC_MARKETING_URL", "") | ||
NEXT_PRIVATE_DATABASE_URL = data.get("NEXT_PRIVATE_DATABASE_URL", '') | ||
NEXT_PRIVATE_DIRECT_DATABASE_URL = data.get("NEXT_PRIVATE_DIRECT_DATABASE_URL", '') | ||
|
||
NEXT_PUBLIC_UPLOAD_TRANSPORT = data.get("NEXT_PUBLIC_UPLOAD_TRANSPORT", "database") | ||
NEXT_PRIVATE_UPLOAD_ENDPOINT = data.get("NEXT_PRIVATE_UPLOAD_ENDPOINT") | ||
NEXT_PRIVATE_UPLOAD_FORCE_PATH_STYLE = data.get("NEXT_PRIVATE_UPLOAD_FORCE_PATH_STYLE") | ||
NEXT_PRIVATE_UPLOAD_REGION = data.get("NEXT_PRIVATE_UPLOAD_REGION") | ||
NEXT_PRIVATE_UPLOAD_BUCKET = data.get("NEXT_PRIVATE_UPLOAD_BUCKET") | ||
NEXT_PRIVATE_UPLOAD_ACCESS_KEY_ID = data.get("NEXT_PRIVATE_UPLOAD_ACCESS_KEY_ID") | ||
NEXT_PRIVATE_UPLOAD_SECRET_ACCESS_KEY = data.get("NEXT_PRIVATE_UPLOAD_SECRET_ACCESS_KEY") | ||
|
||
NEXT_PRIVATE_SMTP_TRANSPORT = data.get("NEXT_PRIVATE_SMTP_TRANSPORT") | ||
NEXT_PRIVATE_SMTP_HOST = data.get("NEXT_PRIVATE_SMTP_HOST") | ||
NEXT_PRIVATE_SMTP_PORT = data.get("NEXT_PRIVATE_SMTP_PORT") | ||
NEXT_PRIVATE_SMTP_USERNAME = data.get("NEXT_PRIVATE_SMTP_USERNAME") | ||
NEXT_PRIVATE_SMTP_PASSWORD = data.get("NEXT_PRIVATE_SMTP_PASSWORD") | ||
NEXT_PRIVATE_SMTP_APIKEY_USER = data.get("NEXT_PRIVATE_SMTP_APIKEY_USER") | ||
NEXT_PRIVATE_SMTP_APIKEY = data.get("NEXT_PRIVATE_SMTP_APIKEY") | ||
NEXT_PRIVATE_SMTP_SECURE = data.get("NEXT_PRIVATE_SMTP_SECURE") | ||
NEXT_PRIVATE_SMTP_FROM_NAME = data.get("NEXT_PRIVATE_SMTP_FROM_NAME") | ||
NEXT_PRIVATE_SMTP_FROM_ADDRESS = data.get("NEXT_PRIVATE_SMTP_FROM_ADDRESS") | ||
|
||
NEXT_PRIVATE_RESEND_API_KEY = data.get("NEXT_PRIVATE_RESEND_API_KEY") | ||
|
||
NEXT_PRIVATE_MAILCHANNELS_API_KEY = data.get("NEXT_PRIVATE_MAILCHANNELS_API_KEY") | ||
NEXT_PRIVATE_MAILCHANNELS_ENDPOINT = data.get("NEXT_PRIVATE_MAILCHANNELS_ENDPOINT") | ||
NEXT_PRIVATE_MAILCHANNELS_DKIM_DOMAIN = data.get("NEXT_PRIVATE_MAILCHANNELS_DKIM_DOMAIN") | ||
NEXT_PRIVATE_MAILCHANNELS_DKIM_SELECTOR = data.get("NEXT_PRIVATE_MAILCHANNELS_DKIM_SELECTOR") | ||
NEXT_PRIVATE_MAILCHANNELS_DKIM_PRIVATE_KEY = data.get("NEXT_PRIVATE_MAILCHANNELS_DKIM_PRIVATE_KEY") | ||
|
||
NEXT_PUBLIC_DOCUMENT_SIZE_UPLOAD_LIMIT = data.get("NEXT_PUBLIC_DOCUMENT_SIZE_UPLOAD_LIMIT") | ||
|
||
NEXT_PUBLIC_POSTHOG_KEY = data.get("NEXT_PUBLIC_POSTHOG_KEY") | ||
NEXT_PUBLIC_DISABLE_SIGNUP = data.get("NEXT_PUBLIC_DISABLE_SIGNUP") | ||
NEXT_PRIVATE_SIGNING_LOCAL_FILE_PATH = data.get("NEXT_PRIVATE_SIGNING_LOCAL_FILE_PATH", "/opt/documenso/cert.p12") | ||
|
||
next_config = { | ||
"NEXTAUTH_URL": NEXTAUTH_URL, | ||
"NEXTAUTH_SECRET": NEXTAUTH_SECRET, | ||
"NEXT_PRIVATE_ENCRYPTION_KEY": NEXT_PRIVATE_ENCRYPTION_KEY, | ||
"NEXT_PRIVATE_ENCRYPTION_SECONDARY_KEY": NEXT_PRIVATE_ENCRYPTION_SECONDARY_KEY, | ||
"NEXT_PRIVATE_GOOGLE_CLIENT_ID": NEXT_PRIVATE_GOOGLE_CLIENT_ID, | ||
"NEXT_PRIVATE_GOOGLE_CLIENT_SECRET": NEXT_PRIVATE_GOOGLE_CLIENT_SECRET, | ||
"NEXT_PUBLIC_WEBAPP_URL": NEXT_PUBLIC_WEBAPP_URL, | ||
"NEXT_PUBLIC_MARKETING_URL": NEXT_PUBLIC_MARKETING_URL, | ||
"NEXT_PRIVATE_DATABASE_URL": NEXT_PRIVATE_DATABASE_URL, | ||
"NEXT_PRIVATE_DIRECT_DATABASE_URL": NEXT_PRIVATE_DIRECT_DATABASE_URL, | ||
"NEXT_PUBLIC_UPLOAD_TRANSPORT": NEXT_PUBLIC_UPLOAD_TRANSPORT, | ||
"NEXT_PRIVATE_UPLOAD_ENDPOINT": NEXT_PRIVATE_UPLOAD_ENDPOINT, | ||
"NEXT_PRIVATE_UPLOAD_FORCE_PATH_STYLE": NEXT_PRIVATE_UPLOAD_FORCE_PATH_STYLE, | ||
"NEXT_PRIVATE_UPLOAD_REGION": NEXT_PRIVATE_UPLOAD_REGION, | ||
"NEXT_PRIVATE_UPLOAD_BUCKET": NEXT_PRIVATE_UPLOAD_BUCKET, | ||
"NEXT_PRIVATE_UPLOAD_ACCESS_KEY_ID": NEXT_PRIVATE_UPLOAD_ACCESS_KEY_ID, | ||
"NEXT_PRIVATE_UPLOAD_SECRET_ACCESS_KEY": NEXT_PRIVATE_UPLOAD_SECRET_ACCESS_KEY, | ||
"NEXT_PRIVATE_SMTP_TRANSPORT": NEXT_PRIVATE_SMTP_TRANSPORT, | ||
"NEXT_PRIVATE_SMTP_HOST": NEXT_PRIVATE_SMTP_HOST, | ||
"NEXT_PRIVATE_SMTP_PORT": NEXT_PRIVATE_SMTP_PORT, | ||
"NEXT_PRIVATE_SMTP_USERNAME": NEXT_PRIVATE_SMTP_USERNAME, | ||
"NEXT_PRIVATE_SMTP_PASSWORD": NEXT_PRIVATE_SMTP_PASSWORD, | ||
"NEXT_PRIVATE_SMTP_APIKEY_USER": NEXT_PRIVATE_SMTP_APIKEY_USER, | ||
"NEXT_PRIVATE_SMTP_APIKEY": NEXT_PRIVATE_SMTP_APIKEY, | ||
"NEXT_PRIVATE_SMTP_SECURE": NEXT_PRIVATE_SMTP_SECURE, | ||
"NEXT_PRIVATE_SMTP_FROM_NAME": NEXT_PRIVATE_SMTP_FROM_NAME, | ||
"NEXT_PRIVATE_SMTP_FROM_ADDRESS": NEXT_PRIVATE_SMTP_FROM_ADDRESS, | ||
"NEXT_PRIVATE_RESEND_API_KEY": NEXT_PRIVATE_RESEND_API_KEY, | ||
"NEXT_PRIVATE_MAILCHANNELS_API_KEY": NEXT_PRIVATE_MAILCHANNELS_API_KEY, | ||
"NEXT_PRIVATE_MAILCHANNELS_ENDPOINT": NEXT_PRIVATE_MAILCHANNELS_ENDPOINT, | ||
"NEXT_PRIVATE_MAILCHANNELS_DKIM_DOMAIN": NEXT_PRIVATE_MAILCHANNELS_DKIM_DOMAIN, | ||
"NEXT_PRIVATE_MAILCHANNELS_DKIM_SELECTOR": NEXT_PRIVATE_MAILCHANNELS_DKIM_SELECTOR, | ||
"NEXT_PRIVATE_MAILCHANNELS_DKIM_PRIVATE_KEY": NEXT_PRIVATE_MAILCHANNELS_DKIM_PRIVATE_KEY, | ||
"NEXT_PUBLIC_DOCUMENT_SIZE_UPLOAD_LIMIT": NEXT_PUBLIC_DOCUMENT_SIZE_UPLOAD_LIMIT, | ||
"NEXT_PUBLIC_POSTHOG_KEY": NEXT_PUBLIC_POSTHOG_KEY, | ||
"NEXT_PUBLIC_DISABLE_SIGNUP": NEXT_PUBLIC_DISABLE_SIGNUP, | ||
"NEXT_PRIVATE_SIGNING_LOCAL_FILE_PATH": NEXT_PRIVATE_SIGNING_LOCAL_FILE_PATH, | ||
} | ||
|
||
agent.write_envfile("documenso.env", next_config) | ||
|
||
|
||
# Make sure everything is saved inside the environment file | ||
# just before starting systemd unit | ||
#agent.dump_env() |