Setting Sentry-attributes based on spring profile - spring

Is there any way to set different values for sentry attributes based on the current Spring profile?
The current attributes are located in the sentry.properties file...
Unfortunately naming it like the application.properties method (application-profilename.properties) does not work. Because the changes in a sentry-profilename.properties file aren't recognised.
So ideal would be:
sentry.properties (base information)
sentry-dev.properties (environment attribute = dev)
sentry-prod.properties (environment attribute = prod)

Ok, we defined the systems variable SENTRY_ENVIRONMENT to dev or prod (based on the current deployment pipeline).
So this solved our issue and we got the wanted result in the sentry.io overview!

"You can override the location of the properties file by using either the sentry.properties.file Java System Property or the SENTRY_PROPERTIES_FILE System Environment Variable." this is from "https://docs.sentry.io/clients/java/config/#configuration"

Related

Use variables from settings.xml but override with environment variables in Maven

I'm trying to use a property in my Maven POM file to specify the URL / username / password to a private repository. I would like to get the value for this property from a settings.xml file (from either the global, user or project settings file) but use the value from a specific environment variable to override any of that if it is set.
I've searched a bunch and I've found some references to using build profiles which doesn't seem to be quite what I need, but then again I'm not very fluent in Maven so I might just be missing something there. I feel like an idiot because I would think this is a pretty common use case.
In general I'm not too keen on defining secrets (passwords or API keys) in environment variables but for now we need to do that to avoid having to change the whole CI pipeline.

Setting the values to the JavaScript Global variables setting in SonarQube

I have an ASP.NET MVC application and I added the sonar-project.properties file to the same folder as the solution file. I just wanted to add a global variable to the sonar.javascript.globals setting, but it doesn't seem have an impact. I don't have access to the machine where SonarQube runs, I am just able to see the violations in a SonarQube website. I just have the 3 settings in the sonar-project.properties
sonar.projectKey= <key>
sonar.projectName= <name>
sonar.javascript.globals= <global_variable_name>
I solved this problem by marking the JavaScript global variable to be a member of the window object. SonarQube now no longer complains the variable is undeclared.
For e.g. window.<variable>

How to get value of Configuration parameter in teamcity using Gradle?

I have been trying to get the value of configuration parameter since yesterday but no luck. On the documentation I can call it using this teamcity["<property name>"] but it wont work.
Say I have a configuration parameter called "isPaid". I want to get the "isPaid" param value in my gradle. How can I do that? Shouldn't that be
System.getProperty("teamcity[isPaid]")
Tried using both getProperty and getEnv but still did not work. Any ideas? Thanks
Configuration parameters (no prefix) are not passed into the build and are only meant to share settings within a build configuration.
https://www.jetbrains.com/help/teamcity/configuring-build-parameters.html

Checking a remote url depending upon config

I am a new NativeScript user and I am trying to understand how to have my app make a GET call to a remote server, depending upon environment. In Java world we pass in an environment variable, but I have not found an example (that I understand) demonstrating how my NativeScript mobile app will know which environment it is running in, and how to get values based upon that.
I am presuming that I will have a config/ with files such as
prod.conf.js and dev.conf.js - and there is where I will put in my urls and other config values.
How do I get my NativeScript (which I will eventually build into iOS) to reach those values to use in an http request upon startup. Any example to direction to documentation would be greatly appreciated.
Answer:
I finally got the problem solved by using Manoj suggestion of nativescript-dev-appconfig. For any newbie looking for help, try this:
{PROJECT_ROOT}/config - create the environment files as {env}.json. These files are just json, with name-value pairs of the values you want. In may case that is
When you do your build: tns build ios --bundle --env.config {dev | test | prod }
This will take the contents of the selected env.config file (ie -env.config dev and copy it as - {PROJECT_ROOT}/app/config.json .
To use it within your code,
import config from "../config.json";
axios.get(config.MY_URL).then(result => {...}
Unfortunately using environment based config files are not officially supported but there is a plugin hook you could try.
We also have webpack based environment variable support, read more about that in the docs.

Team City 7.1 Configuration Parameters across Build Configurations

I would like to define a variable on a TC configuration and would like to get its value on a different TC configuration that has a trigger dependency on the first one.
Is it possible to do this?
If both configurations are in the same project, you can define a build configuration template that contains the shared parameter (i.e. variable). Both active configurations must then reference that template -- use the 'Associate with Template' action to accomplish this. The value of the shared parameter must be set in the template in order for the same value to be known to both configurations.
If you're trying to share build numbers (or other system-level parameters) between the configurations, there is a special method for that.
I have to use something like this to actually dynamically change the configuration parameters.
Invoke-WebRequest -Uri "http://build/guestAuth/action.html?add2Queue=bt876&name=env&value=test&name=env.number&value=%target.env.number%" -Method "Get" -Verbose

Resources