Skip to content
This repository has been archived by the owner on Oct 25, 2021. It is now read-only.

feat: Set app-secret dynamically in code #25

Open
dylanvdmerwe opened this issue Feb 18, 2018 · 6 comments
Open

feat: Set app-secret dynamically in code #25

dylanvdmerwe opened this issue Feb 18, 2018 · 6 comments

Comments

@dylanvdmerwe
Copy link

We have many automated build processes which set different variables depending on the OS and environment.

It would be great to be able to set the App Secret value through JS instead of in the config.xml file.

@annakocheshkova
Copy link
Contributor

annakocheshkova commented May 23, 2018

@dylanvdmerwe, thank you for your feature request and sorry for the delay.
As it is in App Center SDK for now, you can't change the app secret key once it is set. In SDK, they have the following workflow: the app secret is passed to the AppCenter.configure method, where it is used to configure the main App Center module, and then the same secret is used when one of the App Center services (e. g. Crashes) is started.

In short: in a lifecycle of an app, you can only set the app secret once, before using any of the SDK features.

So could you please clarify to us what it is that you want to do:

  • if your goal is to change app secret keys multiple times during the app lifecycle, then the answer is no, this is not possible, because we can't do something that isn't a part of the App Center SDK API.
  • if you want just a "fallback" for config.xml (the ability to set the secret in code if there's no entry in config), then the answer is yes, it can be done.

@erwinokken
Copy link

Even though I'm not the author, I think he ment the second thing. That will allow others to change the ID during CI/CD phase easily (the way everyone is used to).

@patniko
Copy link
Contributor

patniko commented Oct 3, 2018

I would recommend a simple sed script to replace the app secret at build time. It is what most of our users do today to override keys for different environments when necessary and gives you the flexibility to modify this without having to go into code at all.

@adamterlson
Copy link

@annakocheshkova I, I believe like the author above, want to accomplish the second point: "the ability to set the secret in code..."

You say it can be done—how?

@annakocheshkova
Copy link
Contributor

@adamterlson unfortunately, this requires some work to be done in the plugin, that is why this is a feature request. We will keep this thread open for visibility and keep you posted once we plan to support it for Cordova.

@timoknapp
Copy link
Member

@annakocheshkova I'd also be interested in that feature. As you have outlined correctly in your initial reply, it is indeed about the fallback of setting the appSecret throughout the code. I actually used that in your early versions of the HockeyApp SDK before it got migrated to MS AppCenter.

Is there any update with regard to that feature request? Otherwise I'd also be happy to contribute accordingly. I really would like to get rid of my hacky sed commands 😁

Cheers!

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

No branches or pull requests

8 participants