Skip to content

Commit

Permalink
Minor formatting updates and fix incorrect ternary expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewelwell committed Dec 5, 2024
1 parent e690de6 commit 1d99f6f
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion frontend/common/code-help/init/init-dotnet.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = (
static FlagsmithClient _flagsmithClient;
_flagsmithClient = new("${envId}"${
Constants.isCustomFlagsmithUrl() ? `, apiUrl: ${Constants.getFlagsmithSDKUrl()}` : ''
Constants.isCustomFlagsmithUrl() ? `, apiUrl: "${Constants.getFlagsmithSDKUrl()}"` : ''
});
var flags = await _flagsmithClient.GetEnvironmentFlags(); # This method triggers a network request
Expand Down
7 changes: 4 additions & 3 deletions frontend/common/code-help/init/init-go.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ defer cancel()
// Initialise the Flagsmith client
client := flagsmith.NewClient('${envId}',${
Constants.isCustomFlagsmithUrl() &&
`\nflagsmith.WithBaseURL("${Constants.getFlagsmithSDKUrl()}"),\n`
}flagsmith.WithContext(ctx))
Constants.isCustomFlagsmithUrl()
? `\n flagsmith.WithBaseURL("${Constants.getFlagsmithSDKUrl()}"),\n`
: '\n'
} flagsmith.WithContext(ctx))
// The method below triggers a network request
flags, _ := client.GetEnvironmentFlags()
Expand Down
4 changes: 3 additions & 1 deletion frontend/common/code-help/init/init-php.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ module.exports = (
) => `use Flagsmith\\Flagsmith;
$flagsmith = new Flagsmith('${envId}'${
Constants.isCustomFlagsmithUrl() && `,\n '${Constants.getFlagsmithSDKUrl()}'\n`
Constants.isCustomFlagsmithUrl()
? `, '${Constants.getFlagsmithSDKUrl()}'`
: ''
});
// Check for a feature
Expand Down
7 changes: 4 additions & 3 deletions frontend/common/code-help/init/init-python.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ module.exports = (
{ FEATURE_NAME, FEATURE_NAME_ALT },
) => `from flagsmith import Flagsmith
flagsmith = Flagsmith(environment_key="${envId}"${
Constants.isCustomFlagsmithUrl() &&
`,\n api_url="${Constants.getFlagsmithSDKUrl()}"\n`
flagsmith = Flagsmith(\n environment_key="${envId}"${
Constants.isCustomFlagsmithUrl()
? `,\n api_url="${Constants.getFlagsmithSDKUrl()}",\n`
: ','
})
# The method below triggers a network request
Expand Down
7 changes: 4 additions & 3 deletions frontend/common/code-help/init/init-ruby.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ module.exports = (
) => `require "flagsmith"
$flagsmith = Flagsmith::Client.new(
environment_key="${envId}"${
Constants.isCustomFlagsmithUrl() &&
`,\n api_url="${Constants.getFlagsmithSDKUrl()}"\n`
environment_key: "${envId}"${
Constants.isCustomFlagsmithUrl()
? `,\n api_url: "${Constants.getFlagsmithSDKUrl()}"\n`
: '\n'
})
// Load the environment's flags locally
Expand Down
5 changes: 3 additions & 2 deletions frontend/common/code-help/init/init-rust.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ module.exports = (envId, { FEATURE_NAME, FEATURE_NAME_ALT }) => `
use flagsmith::{Flag, Flagsmith, FlagsmithOptions};
let options = FlagsmithOptions {${
Constants.isCustomFlagsmithUrl() &&
`api_url: "${Constants.getFlagsmithSDKUrl()}".to_string(),\n`
Constants.isCustomFlagsmithUrl()
? `api_url: "${Constants.getFlagsmithSDKUrl()}".to_string(), `
: ''
}..Default::default()};
let flagsmith = Flagsmith::new(
"${envId}".to_string(),
Expand Down

0 comments on commit 1d99f6f

Please sign in to comment.