Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add environment identification tag in the header #483

Open
wants to merge 29 commits into
base: main
Choose a base branch
from

Conversation

davidjamesstone
Copy link
Contributor

No description provided.

Copy link

sonarcloud bot commented Sep 20, 2024

@KiranVarma02 KiranVarma02 marked this pull request as draft October 30, 2024 09:57
@KiranVarma02 KiranVarma02 marked this pull request as ready for review October 30, 2024 13:02
Copy link
Contributor

@colinrotherham colinrotherham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @KiranVarma02

Are you happy everything works without needing tests?

You can copy the Nunjucks tests from another component if you like:
https://github.com/DEFRA/forms-designer/blob/main/designer/server/src/common/components/heading/template.test.js

designer/server/src/common/nunjucks/context/index.js Outdated Show resolved Hide resolved
{% endswitch -%}

{{ govukTag({
text: env | capitalize,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we use the replace filter we can keep perf-test (hyphenated) as the env name

Suggested change
text: env | capitalize,
text: env | replace("-", " ") | capitalize,

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @alexluckett said he want perf test not perf-test ?!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I've asked on Slack, doing that prevents use in URLs:

new URL(`http://forms-runner/.${config.env}.cdp-int.defra.cloud`)

@@ -37,14 +38,18 @@ export interface Config {
const schema = joi.object<Config>({
port: joi.number().default(3000),
env: joi
.string()
.valid('development', 'test', 'perf test', 'production')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still thinking we should match these names to how they're used in URLs

We might want to use them to replace wildcards in URLs in future

Suggested change
.valid('development', 'test', 'perf test', 'production')
.valid('dev', 'test', 'perf-test', 'prod')

Copy link
Contributor

@KiranVarma02 KiranVarma02 Nov 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will let @alexluckett decide that I think!

I don't have strong opinion

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll ask on Slack

What shall we use when running locally?

Because the "dev" environment isn't local, e.g.

http://forms-designer.dev.cdp-int.defra.cloud
http://forms-runner.dev.cdp-int.defra.cloud

We'll need maybe local or localhost as the default

Copy link

sonarcloud bot commented Nov 1, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
80.0% Coverage on New Code (required ≥ 90%)

See analysis details on SonarCloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants