Skip to content

Commit ed5979c

Browse files
Fix frontend domain inference
The frontend seems to be expecting the domain pattern to be different than it currently is, expose the inferred domain via gql and fix fe code accordingly
1 parent bd85d21 commit ed5979c

File tree

9 files changed

+17
-21
lines changed

9 files changed

+17
-21
lines changed

.github/workflows/test.yaml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -174,19 +174,6 @@ jobs:
174174
restore-keys: ${{ runner.os }}-mix-6
175175
- run: mix deps.get
176176
- run: mix test
177-
- run: mix coveralls.html
178-
- run: pip3 install ansi2html junit2html
179-
- run: mkdir junit
180-
- run: junit2html _build/test/lib/api/test-junit-report.xml junit/api.html
181-
- run: junit2html _build/test/lib/core/test-junit-report.xml junit/core.html
182-
- run: junit2html _build/test/lib/cron/test-junit-report.xml junit/cron.html
183-
- run: junit2html _build/test/lib/graphql/test-junit-report.xml junit/graphql.html
184-
- run: junit2html _build/test/lib/email/test-junit-report.xml junit/email.html
185-
- run: junit2html _build/test/lib/rtc/test-junit-report.xml junit/rtc.html
186-
- run: junit2html _build/test/lib/worker/test-junit-report.xml junit/worker.html
187-
- name: Run stoat action
188-
uses: stoat-dev/stoat-action@v0
189-
if: always()
190177
- uses: 8398a7/action-slack@v3
191178
with:
192179
status: ${{ job.status }}

apps/core/lib/core/services/cloud.ex

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,10 @@ defmodule Core.Services.Cloud do
9191
|> notify(:create, user)
9292
end
9393

94-
def domain(%ConsoleInstance{name: name, domain_version: :v2}), do: "https://#{name}.console.#{domain()}/oauth/callback"
95-
def domain(%ConsoleInstance{name: name}), do: "https://console.#{name}.#{domain()}/oauth/callback"
94+
def fqdn(%ConsoleInstance{name: name, domain_version: :v2}), do: "#{name}.console.#{domain()}"
95+
def fqdn(%ConsoleInstance{name: name}), do: "console.#{name}.#{domain()}"
96+
97+
def domain(%ConsoleInstance{} = inst), do: "https://#{fqdn(inst)}/oauth/callback"
9698

9799
@doc """
98100
Updates base attributes of a console instance
@@ -203,7 +205,7 @@ defmodule Core.Services.Cloud do
203205
end
204206

205207
def add_configuration(attrs, name, token, %OIDCProvider{} = oidc, %User{} = user) do
206-
Map.merge(attrs, %{subdomain: "#{name}.#{domain()}", url: "console.#{name}.#{domain()}"})
208+
Map.merge(attrs, %{subdomain: "#{name}.#{domain()}", url: "#{name}.console.#{domain()}"})
207209
|> Map.put(:configuration, %{
208210
aes_key: aes_key(),
209211
encryption_key: encryption_key(),

apps/graphql/lib/graphql/resolvers/cloud.ex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ defmodule GraphQl.Resolvers.Cloud do
1515
ok(Clusters.get_cluster_by_url("https://#{url}") || Clusters.get_cluster_by_url(url))
1616
end
1717

18+
def resolve_domain(%ConsoleInstance{} = inst, _, _), do: {:ok, Cloud.fqdn(inst)}
19+
1820
def list_instances(args, %{context: %{current_user: user}}) do
1921
ConsoleInstance.for_account(user.account_id)
2022
|> ConsoleInstance.ordered()

apps/graphql/lib/graphql/schema/cloud.ex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ defmodule GraphQl.Schema.Cloud do
5252
field :network, :console_instance_network, description: "the network configuration for this instance"
5353
field :oidc, :console_instance_oidc, description: "custom oidc configuration for this instance"
5454

55+
field :domain, :string, description: "the domain of this instance", resolve: &Cloud.resolve_domain/3
56+
5557
field :status, non_null(:console_instance_status),
5658
description: "the provisioning status of this instance, liveness is fetched through the console field"
5759

plural/helm/plural/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: plural
33
description: A helm chart for installing plural
44
appVersion: 0.11.8
5-
version: 0.10.105
5+
version: 0.10.106
66
dependencies:
77
- name: hydra
88
version: 0.26.5

plural/helm/plural/values.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,6 @@ crons:
199199
cronModule: Prune.Stacks
200200
crontab: "55 0 * * *"
201201
envVars: []
202-
- cronName: plrl-sync-usage
203-
cronModule: Task.Usage
204-
crontab: "0 0 * * *"
205-
envVars: []
206202
- cronName: plrl-prune-trials
207203
cronModule: Prune.Trials
208204
cronTab: "40 0 * * *"

rel/config/cron.exs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
import Config
22

33
config :core, start_broker: true
4+
5+
config :stripity_stripe, api_key: get_env("STRIPE_SECRET")

schema/schema.graphql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,9 @@ type ConsoleInstance {
665665
"custom oidc configuration for this instance"
666666
oidc: ConsoleInstanceOidc
667667

668+
"the domain of this instance"
669+
domain: String
670+
668671
"the provisioning status of this instance, liveness is fetched through the console field"
669672
status: ConsoleInstanceStatus!
670673

www/src/generated/graphql.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,8 @@ export type ConsoleInstance = {
581581
console?: Maybe<Cluster>;
582582
/** the time this instance was deleted on */
583583
deletedAt?: Maybe<Scalars['DateTime']['output']>;
584+
/** the domain of this instance */
585+
domain?: Maybe<Scalars['String']['output']>;
584586
id: Scalars['ID']['output'];
585587
insertedAt?: Maybe<Scalars['DateTime']['output']>;
586588
/** the name of this instance (globally unique) */

0 commit comments

Comments
 (0)