Skip to content

Commit 56dbf3b

Browse files
authored
hotfix(view): Supertoken/AppInfo Env naming for client side config (#478)
1 parent 81ceb17 commit 56dbf3b

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

cli/app/commands/install/run.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
"view_port": _config.get_yaml_value(VIEW_PORT),
8383
"api_port": _config.get_yaml_value(API_PORT),
8484
"docker_port": _config.get_yaml_value(DOCKER_PORT),
85+
"supertokens_api_port": 3567,
8586
}
8687

8788

@@ -114,7 +115,7 @@ def __init__(
114115
self.main_task = None
115116
self._validate_domains()
116117
self._validate_repo()
117-
118+
118119
# Log when using custom repository/branch and staging compose file
119120
if self._is_custom_repo_or_branch():
120121
if self.logger:
@@ -126,13 +127,13 @@ def _get_config(self, key: str):
126127
return self.repo
127128
if key == "branch_name" and self.branch is not None:
128129
return self.branch
129-
130+
130131
# Override compose_file_path to use docker-compose-staging.yml when custom repo/branch is provided
131132
if key == "compose_file_path" and self._is_custom_repo_or_branch():
132133
# Get the base directory and replace docker-compose.yml with docker-compose-staging.yml
133134
default_compose_path = _config.get_config_value(key, self._user_config, DEFAULTS)
134135
return default_compose_path.replace("docker-compose.yml", "docker-compose-staging.yml")
135-
136+
136137
try:
137138
return _config.get_config_value(key, self._user_config, DEFAULTS)
138139
except ValueError:
@@ -163,11 +164,11 @@ def _is_custom_repo_or_branch(self):
163164
"""Check if custom repository or branch is provided (different from defaults)"""
164165
default_repo = _config.get_yaml_value(DEFAULT_REPO) # "https://github.com/raghavyuva/nixopus"
165166
default_branch = _config.get_yaml_value(DEFAULT_BRANCH) # "master"
166-
167+
167168
# Check if either repo or branch differs from defaults
168169
repo_differs = self.repo is not None and self.repo != default_repo
169170
branch_differs = self.branch is not None and self.branch != default_branch
170-
171+
171172
return repo_differs or branch_differs
172173

173174
def run(self):
@@ -424,13 +425,20 @@ def _update_environment_variables(self, env_values: dict) -> dict:
424425
view_host = self.view_domain if secure else f"{host_ip}:{self._get_config('view_port')}"
425426
protocol = "https" if secure else "http"
426427
ws_protocol = "wss" if secure else "ws"
428+
super_tokens_api_port = self._get_config("services.api.env.SUPERTOKENS_API_PORT") or 3567
427429
key_map = {
428430
"ALLOWED_ORIGIN": f"{protocol}://{view_host}",
429431
"SSH_HOST": host_ip,
430432
"SSH_PRIVATE_KEY": self._get_config("ssh_key_path"),
431433
"WEBSOCKET_URL": f"{ws_protocol}://{api_host}/ws",
432434
"API_URL": f"{protocol}://{api_host}/api",
433435
"WEBHOOK_URL": f"{protocol}://{api_host}/api/v1/webhook",
436+
"NEXT_PUBLIC_API_URL": f"{protocol}://{api_host}/api",
437+
"NEXT_PUBLIC_WEBSITE_DOMAIN": f"{protocol}://{view_host}",
438+
"SUPERTOKENS_API_KEY": "NixopusSuperTokensAPIKey",
439+
"SUPERTOKENS_API_DOMAIN": f"{protocol}://{api_host}/api",
440+
"SUPERTOKENS_WEBSITE_DOMAIN": f"{protocol}://{view_host}",
441+
"SUPERTOKENS_CONNECTION_URI": f"{protocol}://{api_host}:{super_tokens_api_port}/api",
434442
}
435443

436444
for key, value in key_map.items():

cli/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "nixopus"
3-
version = "0.1.5"
3+
version = "0.1.6"
44
description = "A CLI for Nixopus"
55
authors = ["Nixopus <[email protected]>"]
66
readme = "README.md"

helpers/config.prod.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,15 @@ services:
3131
SUPERTOKENS_API_DOMAIN: ${SUPERTOKENS_API_DOMAIN:-http://localhost:3567}
3232
SUPERTOKENS_WEBSITE_DOMAIN: ${SUPERTOKENS_WEBSITE_DOMAIN:-http://localhost:3000}
3333
SUPERTOKENS_CONNECTION_URI: ${SUPERTOKENS_CONNECTION_URI:-http://localhost:3567}
34+
SUPERTOKENS_API_PORT: ${SUPERTOKENS_API_PORT:-3567}
3435

3536
view:
3637
env:
3738
PORT: ${VIEW_PORT:-7443}
3839
WEBSOCKET_URL: ${WEBSOCKET_URL:-}
3940
API_URL: ${API_URL:-}
41+
NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL:-}
42+
NEXT_PUBLIC_WEBSITE_DOMAIN: ${NEXT_PUBLIC_WEBSITE_DOMAIN:-}
4043
WEBHOOK_URL: ${WEBHOOK_URL:-}
4144
NEXT_PUBLIC_PORT: ${NEXT_PUBLIC_PORT:-7443}
4245
LOGS_PATH: ${LOGS_PATH:-./logs}

view/app/config/appInfo.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
export const appInfo = {
22
// learn more about this on https://supertokens.com/docs/thirdpartyemailpassword/appinfo
33
appName: 'Nixopus',
4-
apiDomain: process.env.API_URL?.replace('/api', '') || 'http://localhost:8080',
5-
websiteDomain: process.env.WEBSITE_DOMAIN || 'http://localhost:3000',
4+
apiDomain: process.env.NEXT_PUBLIC_API_URL?.replace('/api', ''),
5+
websiteDomain: process.env.NEXT_PUBLIC_WEBSITE_DOMAIN || 'http://localhost:3000',
66
apiBasePath: '/auth',
77
websiteBasePath: '/auth'
88
};

0 commit comments

Comments
 (0)