Skip to content

Commit aedb15b

Browse files
committed
chore(front): get rid of on_prem util
1 parent 88a9fc7 commit aedb15b

24 files changed

+39
-70
lines changed

front/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ CONTAINER_ENV_VARS = \
5252

5353

5454
CONTAINER_CE_ENV_VARS =\
55-
-e CE_ROLES=true \
55+
-e EDITION=ce \
5656
-e SEED_CLOUD_MACHINES=false \
5757
-e SEED_SELF_HOSTED_AGENTS=true \
5858
-e SEED_CE_FEATURES=true \

front/config/runtime.exs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ config :front,
5757
cookie_name: System.get_env("COOKIE_NAME"),
5858
use_rbac_api: if(System.get_env("USE_RBAC_API") == "true", do: true, else: false)
5959

60-
on_prem? = if(System.get_env("ON_PREM") == "true", do: true, else: false)
61-
6260
# Internal API endpoints - always read from environment variables for all environments
6361
# Test environment will need these env vars set, or use stubs in test setup
6462
config :front,
@@ -131,11 +129,8 @@ config :front,
131129
zendesk_snippet_id: System.get_env("ZENDESK_SNIPPET_ID"),
132130
google_gtag: System.get_env("GOOGLE_GTAG")
133131

134-
config :front, :on_prem?, on_prem?
135-
136-
137132
edition = System.get_env("EDITION", "") |> String.trim() |> String.downcase()
138-
is_saas? = !(on_prem? or edition in ["ce", "ee"])
133+
is_saas? = !(edition in ["ce", "ee"])
139134

140135
if is_saas? do
141136
config :front,
@@ -170,8 +165,6 @@ end
170165

171166
config :front, :audit_logging, System.get_env("AUDIT_LOGGING") == "true"
172167

173-
config :front, :ce_roles, System.get_env("CE_ROLES") == "true"
174-
175168
config :front,
176169
:hide_promotions,
177170
System.get_env("HIDE_PROMOTIONS") == "true"

front/helm/templates/job-page.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,6 @@ spec:
122122
{{- if eq .Values.global.edition "ce" }}
123123
- name: "SKIP_VELOCITY"
124124
value: "true"
125-
- name: "CE_ROLES"
126-
value: "true"
127125
- name: "HIDE_PROMOTIONS"
128126
value: "true"
129127
{{- end }}

front/helm/templates/project-page.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,6 @@ spec:
152152
{{- if eq .Values.global.edition "ce" }}
153153
- name: "SKIP_VELOCITY"
154154
value: "true"
155-
- name: "CE_ROLES"
156-
value: "true"
157155
- name: "HIDE_PROMOTIONS"
158156
value: "true"
159157
{{- end }}

front/helm/templates/ui-cache-reactor.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,6 @@ spec:
104104
{{- if eq .Values.global.edition "ce" }}
105105
- name: "SKIP_VELOCITY"
106106
value: "true"
107-
- name: "CE_ROLES"
108-
value: "true"
109107
- name: "HIDE_PROMOTIONS"
110108
value: "true"
111109
{{- end }}

front/lib/front.ex

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,4 @@
11
defmodule Front do
2-
@doc """
3-
Checks if application is running on-prem environment
4-
"""
5-
@spec on_prem?() :: boolean()
6-
def on_prem? do
7-
Application.get_env(:front, :on_prem?)
8-
end
9-
10-
@spec ce_roles?() :: boolean()
11-
def ce_roles? do
12-
Application.get_env(:front, :ce_roles)
13-
end
14-
152
@doc """
163
Check if it's CE edition
174
"""
@@ -41,6 +28,6 @@ defmodule Front do
4128
"""
4229
@spec saas?() :: boolean()
4330
def saas? do
44-
!(on_prem?() or os?())
31+
!os?()
4532
end
4633
end

front/lib/front_web/controllers/organization_okta_controller.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ defmodule FrontWeb.OrganizationOktaController do
8484
with {:ok, model} <- create_integration(org_id, user_id, integration),
8585
{:ok, token} <- gen_token(model) do
8686
Watchman.increment(watchman_name(:create, :success))
87-
if Front.on_prem?(), do: log_create(conn, user_id, model)
87+
if Front.os?(), do: log_create(conn, user_id, model)
8888

8989
conn
9090
|> put_flash(:notice, "Success: Your organization is connected with Okta")

front/lib/front_web/controllers/page_controller.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ defmodule FrontWeb.PageController do
1818
def status404(conn, _params) do
1919
# On onprem, if user isn't logged in, we want to redirect user to okta login
2020
# right away, without showing the 404 page
21-
if anonymous?(conn) == true and Front.on_prem?() do
21+
if anonymous?(conn) == true and Front.os?() do
2222
conn
2323
|> put_resp_header("location", login_url(conn))
2424
|> send_resp(302, "")

front/lib/front_web/controllers/people_controller.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ defmodule FrontWeb.PeopleController do
284284
user_type = params["type"] || ""
285285

286286
member_role_id =
287-
if Front.ce_roles?() do
287+
if Front.ce?() do
288288
{:ok, roles} = RoleManagement.list_possible_roles(org_id, "org_scope")
289289

290290
member_role = Enum.find(roles, fn role -> role.name == "Member" end)
@@ -501,7 +501,7 @@ defmodule FrontWeb.PeopleController do
501501

502502
defp create_email_member(conn, params) do
503503
Watchman.benchmark("people.create_member", fn ->
504-
if email_members_supported?(conn.assigns.organization_id) || Front.ce_roles?() do
504+
if email_members_supported?(conn.assigns.organization_id) || Front.ce?() do
505505
user_id = conn.assigns.user_id
506506
org_id = conn.assigns.organization_id
507507

@@ -800,7 +800,7 @@ defmodule FrontWeb.PeopleController do
800800

801801
defp change_user_email(conn, user_id, email) do
802802
Watchman.benchmark("people.change_email", fn ->
803-
if email_members_supported?(conn.assigns.organization_id) || Front.ce_roles?() do
803+
if email_members_supported?(conn.assigns.organization_id) || Front.ce?() do
804804
conn
805805
|> Audit.new(:User, :Modified)
806806
|> Audit.add(description: "Change Email")
@@ -867,7 +867,7 @@ defmodule FrontWeb.PeopleController do
867867

868868
defp reset_user_password(conn, user_id) do
869869
Watchman.benchmark("people.reset_password", fn ->
870-
if email_members_supported?(conn.assigns.organization_id) || Front.ce_roles?() do
870+
if email_members_supported?(conn.assigns.organization_id) || Front.ce?() do
871871
conn
872872
|> Audit.new(:User, :Modified)
873873
|> Audit.add(description: "Reset Password")

front/lib/front_web/controllers/project_onboarding_controller.ex

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -630,15 +630,14 @@ defmodule FrontWeb.ProjectOnboardingController do
630630
) do
631631
project_onboarding_path(conn, :onboarding_index, project.name, [""])
632632
else
633-
# TODO: check with Amir
634-
if Front.on_prem?() do
633+
if Front.saas?() do
634+
project_onboarding_path(conn, :invite_collaborators, project.name)
635+
else
635636
if Models.Project.file_exists?(project.id, project.initial_pipeline_file) do
636637
project_onboarding_path(conn, :existing_configuration, project.name)
637638
else
638639
project_onboarding_path(conn, :template, project.name)
639640
end
640-
else
641-
project_onboarding_path(conn, :invite_collaborators, project.name)
642641
end
643642
end
644643

0 commit comments

Comments
 (0)