From f20629b1dcf150e7ba98ec7eb39c2966845241b9 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Mon, 26 May 2025 15:58:33 +0300 Subject: [PATCH] Update the Enterprise submodule and make use of the newly added secrets configuration mechanism --- ElementX/Sources/Application/AppCoordinator.swift | 2 +- ElementX/Sources/Application/AppSettings.swift | 2 +- Secrets/Secrets.pkl | 1 + Secrets/Secrets.swift | 2 +- docs/FORKING.md | 10 ++++------ fastlane/Fastfile | 10 ++-------- 6 files changed, 10 insertions(+), 17 deletions(-) diff --git a/ElementX/Sources/Application/AppCoordinator.swift b/ElementX/Sources/Application/AppCoordinator.swift index c78e531eb..df73c34d9 100644 --- a/ElementX/Sources/Application/AppCoordinator.swift +++ b/ElementX/Sources/Application/AppCoordinator.swift @@ -74,7 +74,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg Target.mainApp.configure(logLevel: appSettings.logLevel, traceLogPacks: appSettings.traceLogPacks, - sentryURL: appSettings.bugReportSDKSentryURL) + sentryURL: appSettings.bugReportSentryRustURL) let appName = InfoPlistReader.main.bundleDisplayName let appVersion = InfoPlistReader.main.bundleShortVersionString diff --git a/ElementX/Sources/Application/AppSettings.swift b/ElementX/Sources/Application/AppSettings.swift index 915ae3277..df1e10ba3 100644 --- a/ElementX/Sources/Application/AppSettings.swift +++ b/ElementX/Sources/Application/AppSettings.swift @@ -253,7 +253,7 @@ final class AppSettings { let bugReportServiceBaseURL: URL? = Secrets.rageshakeServerURL.map { URL(string: $0)! } // swiftlint:disable:this force_unwrapping let bugReportSentryURL: URL? = Secrets.sentryDSN.map { URL(string: $0)! } // swiftlint:disable:this force_unwrapping - let bugReportSDKSentryURL: URL? = Secrets.sentrySDKDSN.map { URL(string: $0)! } // swiftlint:disable:this force_unwrapping + let bugReportSentryRustURL: URL? = Secrets.sentryRustDSN.map { URL(string: $0)! } // swiftlint:disable:this force_unwrapping /// The name allocated by the bug report server private(set) var bugReportApplicationID = "element-x-ios" /// The maximum size of the upload request. Default value is just below CloudFlare's max request size. diff --git a/Secrets/Secrets.pkl b/Secrets/Secrets.pkl index 3a6e75169..58cfb312f 100644 --- a/Secrets/Secrets.pkl +++ b/Secrets/Secrets.pkl @@ -10,6 +10,7 @@ import "package://pkg.pkl-lang.org/github.com/element-hq/pkl-tools/staticcode@1.0.1#/StaticCode.pkl" sentryDSN: String? = read?("env:SENTRY_DSN") +sentryRustDSN: String? = read?("env:SENTRY_RUST_DSN") postHogHost: String? = read?("env:POSTHOG_HOST") postHogAPIKey: String? = read?("env:POSTHOG_API_KEY") rageshakeServerURL: String? = read?("env:RAGESHAKE_SERVER_URL") diff --git a/Secrets/Secrets.swift b/Secrets/Secrets.swift index c6c5dece1..e51d1f2e1 100644 --- a/Secrets/Secrets.swift +++ b/Secrets/Secrets.swift @@ -1,6 +1,6 @@ enum Secrets { static let sentryDSN: String? = "https://username@sentry.localhost/project_id" - static let sentrySDKDSN: String? = "https://username@sentry.localhost/project_id" + static let sentryRustDSN: String? = "https://username@sentry.localhost/project_id" static let postHogHost: String? = "https://posthog.localhost" static let postHogAPIKey: String? = "your_key" static let rageshakeServerURL: String? = "https://rageshake.localhost" diff --git a/docs/FORKING.md b/docs/FORKING.md index f1c09ee21..843a84e1c 100644 --- a/docs/FORKING.md +++ b/docs/FORKING.md @@ -29,14 +29,12 @@ The location sharing feature on Element X is currently integrated with [MapLibre The MapLibre SDK requires an API key to work, so you need to get one for yourself. -After you get an API key, you need to configure the project by exporting it and regenerating the `Secrets.swift` file: +After you get an API key, you need to configure the project by updating the `Secrets.swift`. -``` -export MAPLIBRE_API_KEY=your_map_libre_key -bundle exec fastlane config_secrets -``` +It’s not recommended to push your API key in your repository since other people may get it so the mechanism for updating this file is left up to the reader. -It’s not recommended to push your API key in your repository since other people may get it. +An option would be to export it to your environment and use the existing `Secrets.pkl` file to update them like so: +`pkl eval -o Secrets.swift Secrets.pkl` One way to avoid pushing the API key by mistake is running on your machine the command: ``` diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 0fac1f562..3ca1e990a 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -107,7 +107,7 @@ lane :integration_tests do end lane :config_production do - config_secrets() + update_foss_secrets() xcodegen(spec: "project.yml") end @@ -123,7 +123,7 @@ lane :config_nightly do |options| data["include"].append({ "path" => "Variants/Nightly/nightly.yml" }) end - config_secrets() + update_foss_secrets() File.open(target_file_path, 'w') { |f| YAML.dump(data, f) } @@ -313,9 +313,3 @@ private_lane :create_simulator_if_necessary do |options| sh("xcrun simctl create '#{simulator_name}' #{simulator_type} #{simulator_runtime}") end end - -lane :config_secrets do - Dir.chdir "../Secrets" do - sh("pkl eval --cache-dir vendor -o Secrets.swift Secrets.pkl") - end -end