Skip to content

Commit

Permalink
dart format
Browse files Browse the repository at this point in the history
  • Loading branch information
l7ssha committed Nov 21, 2024
1 parent 49c7fd7 commit 63491d2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
7 changes: 5 additions & 2 deletions lib/src/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ String getEnv(String key, [String? def]) =>
bool getEnvBool(String key, [bool? def]) => ['true', '1'].contains(getEnv(key, def?.toString()).toLowerCase());

/// Get a [int] from an environment variable, throwing an exception if cannot be parsed to int.
int getEnvInt(String key, [int? def]) => int.tryParse(getEnv(key, key.toString())) ?? (throw Exception('Environment variable `$key` cannot be parsed as int'));
int getEnvInt(String key, [int? def]) =>
int.tryParse(getEnv(key, key.toString())) ??
(throw Exception('Environment variable `$key` cannot be parsed as int'));

/// Name of the bot
final String botName = getEnv('BOT_NAME', 'Running on Dart');
Expand Down Expand Up @@ -71,7 +73,8 @@ ${docsPackages.map((packageName) => '- $packageName: <https://github.com/nyxx-di
''');

/// The custom content for web server alert box
final String webServerAlertContent = getEnv('WEB_SERVER_ALERT_CONTENT', '<span class="bold">Experimental version</span>');
final String webServerAlertContent =
getEnv('WEB_SERVER_ALERT_CONTENT', '<span class="bold">Experimental version</span>');

/// Whether web server should be enabled
final bool webServerEnabled = getEnvBool('WEB_SERVER_ENABLE', false);
Expand Down
11 changes: 5 additions & 6 deletions lib/src/web_app/api_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,15 @@ class WebServer {

final additionalParameters = switch (templateName) {
'navigation' => {
'clientId': clientId,
'redirectUri': clientRedirectUri,
},
'clientId': clientId,
'redirectUri': clientRedirectUri,
},
'alert' => {
'inner_content': webServerAlertContent,
},
'inner_content': webServerAlertContent,
},
_ => {},
};


return createTwigResponse('component/$templateName.html', parameters: {
...getCustomDataFromSession(request),
...additionalParameters,
Expand Down

0 comments on commit 63491d2

Please sign in to comment.