Skip to content

Commit

Permalink
add configurable default tag name for untagged servers
Browse files Browse the repository at this point in the history
  • Loading branch information
Ithanil committed Apr 25, 2024
1 parent adab3b1 commit dcf2375
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default function ServerTagRow({
if (tag in serverTagsMap) {
return serverTagsMap[tag];
}
return 'Default';
return process.env.DEFAULT_TAG_NAME;
}

const updateAPI = useUpdateAPI();
Expand All @@ -57,9 +57,11 @@ export default function ServerTagRow({
{[
<Dropdown.Item
key=""
value=""
value={process.env.DEFAULT_TAG_NAME}
onClick={() => updateAPI.mutate({ settingName: 'serverTag', settingValue: '' })}
/>,
>
{process.env.DEFAULT_TAG_NAME}
</Dropdown.Item>,
].concat(dropdownTags)}
</SimpleSelect>
</Row>
Expand Down
2 changes: 2 additions & 0 deletions esbuild.dev.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as esbuild from 'esbuild';
// Fetch 'RELATIVE_URL_ROOT' ENV variable value while removing any trailing slashes.
const relativeUrlRoot = (process.env.RELATIVE_URL_ROOT || '').replace(/\/*$/, '');
const serverTagNames = (process.env.SERVER_TAG_NAMES || '');
const defaultTagName = (process.env.DEFAULT_TAG_NAME || '');

esbuild.context({
entryPoints: ['app/javascript/main.jsx'],
Expand All @@ -17,6 +18,7 @@ esbuild.context({
'process.env.RELATIVE_URL_ROOT': `"${relativeUrlRoot}"`,
'process.env.OMNIAUTH_PATH': `"${relativeUrlRoot}/auth/openid_connect"`, // currently, only OIDC is implemented
'process.env.SERVER_TAG_NAMES': `"${serverTagNames}"`,
'process.env.DEFAULT_TAG_NAME': `"${defaultTagName}"`,
},
}).then(context => {
if (process.argv.includes("--watch")) {
Expand Down
2 changes: 2 additions & 0 deletions esbuild.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as esbuild from 'esbuild';
// Fetch 'RELATIVE_URL_ROOT' ENV variable value while removing any trailing slashes.
const relativeUrlRoot = (process.env.RELATIVE_URL_ROOT || '').replace(/\/*$/, '');
const serverTagNames = (process.env.SERVER_TAG_NAMES || '');
const defaultTagName = (process.env.DEFAULT_TAG_NAME || '');

await esbuild.build({
entryPoints: ['app/javascript/main.jsx'],
Expand All @@ -17,6 +18,7 @@ await esbuild.build({
'process.env.RELATIVE_URL_ROOT': `"${relativeUrlRoot}"`,
'process.env.OMNIAUTH_PATH': `"${relativeUrlRoot}/auth/openid_connect"`, // currently, only OIDC is implemented
'process.env.SERVER_TAG_NAMES': `"${serverTagNames}"`,
'process.env.DEFAULT_TAG_NAME': `"${defaultTagName}"`,
},
});

Expand Down
1 change: 1 addition & 0 deletions sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,6 @@ LOG_LEVEL=info
# If your Greenlight instance is connected to Scalelite or another Loadbalancer with enabled support for the 'meta_server-tag'
# parameter on create calls, you can use the following variables to configure support for this feature via the Greenlight UI.
# Example (delimiters are , : and /):
# DEFAULT_TAG_NAME=Standard # friendly name for the untagged/default servers
# SERVER_TAG_NAMES=tag1:Name 1,tag2:Name2 # defines available tags and their friendly names
# SERVER_TAG_ROLES=tag2:xyz-123-321-aaaa-zyx/abc-321-123-zzzz-cba # allow tag only for given role ids (see role ids in DB)

0 comments on commit dcf2375

Please sign in to comment.