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

feat: Ability to customise default environments for new project #3655

Merged
merged 5 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 34 additions & 33 deletions docs/docs/deployment/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,39 +181,40 @@ the platform. For example, if you wanted to disable Google OAuth authentication,

The list of the flags and remote config we're currently using in production is below:

| Flag Name | Description | Text Value |
| ------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------- |
| `4eyes` | Whether to enable the Change Requests feature | None |
| `announcement` | Shows an announcement at the top of the app | None |
| `butter_bar` | Show html in a butter bar for certain users | None |
| `case_sensitive_flags` | Enables the project setting to allow case sensitive flags | None |
| `compare_environments` | Compare feature flag changes across environments | None |
| `configure_hide_sensitive_data` | If the value is true, the hide sensitive data switch will be displayed in the environment settings. | None |
| `dark_mode` | Enables Dark Mode in UI See Below | None |
| `disable_create_org` | Turning this on will prevent users from creating any additional organisations | None |
| `disable_users_as_reviewers` | If enabled, this flag will hide the Assigned users section in the Change Requests and in the Create Change Request modal in the Features page. | None |
| `enable_metadata` | If enabled, metadata can be handled | None |
| `feature_name_regex` | Enables the project setting to add a regex matcher to validate feature names | None |
| `feature_versioning` | Opt into feature versioning for your environment | None |
| `flag_analytics` | Flag usage chart - requires additional infrastructure ([See here](/deployment/overview#flag-analytics)) | None |
| `force_2fa` | Enables the organisation setting to force 2 factor authentication | None |
| `integration_data` | Integration config for different providers | [See Below](#integration_data) |
| `mailing_list` | Determines if mailing list consent is shown on signup | None |
| `max_api_calls_alert` | If enabled, shows an alert message in the top banner when the organization is over a 70% of its API calls limit | None |
| `oauth_github` | GitHub login key | [See Below](#oauth_github) |
| `oauth_google` | Google login key | [See Below](#oauth_google) |
| `payments_enabled` | Determines whether to show payment UI / seats | None |
| `plan_based_access` | Controls rbac and 2f based on plans | None |
| `rotate_api_token` | Enables the ability to rotate a user's access token | [See Below](#oauth_google) |
| `saml` | Enables SAML authentication | [See](/system-administration/authentication/SAML) |
| `segment_associated_features` | Enables the ability to see features associated with a segment | None |
| `segment_operators` | Determines what rules are shown when creating a segment | [See Below](#segment_operators) |
| `serverside_sdk_keys` | Enable Server-side Environment Keys | None |
| `show_role_management` | Show role management tab in OrganisationalSettingsPage | None |
| `sso_idp` | For self hosted, this will automatically redirect to the pre configured IdP | None |
| `tag_environments` | Enables an environment setting to add a UI hint to your environments (e.g. for prod) | None |
| `usage_chart` | Organisation Analytics usage chart - | None |
| `verify_seats_limit_for_invite_links` | Determines whether to show los invite links | None |
| Flag Name | Description | Text Value |
| ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------- |
| `4eyes` | Whether to enable the Change Requests feature | None |
| `announcement` | Shows an announcement at the top of the app | None |
| `butter_bar` | Show html in a butter bar for certain users | None |
| `case_sensitive_flags` | Enables the project setting to allow case sensitive flags | None |
| `compare_environments` | Compare feature flag changes across environments | None |
| `configure_hide_sensitive_data` | If the value is true, the hide sensitive data switch will be displayed in the environment settings. | None |
| `dark_mode` | Enables Dark Mode in UI See Below | None |
| `default_environment_names_for_new_project` | Names of default environments to create when creating a new project (e.g. `["Development", "Production"]`) | None |
| `disable_create_org` | Turning this on will prevent users from creating any additional organisations | None |
| `disable_users_as_reviewers` | If enabled, this flag will hide the Assigned users section in the Change Requests and in the Create Change Request modal in the Features page. | None |
| `enable_metadata` | If enabled, metadata can be handled | None |
| `feature_name_regex` | Enables the project setting to add a regex matcher to validate feature names | None |
| `feature_versioning` | Opt into feature versioning for your environment | None |
| `flag_analytics` | Flag usage chart - requires additional infrastructure ([See here](/deployment/overview#flag-analytics)) | None |
| `force_2fa` | Enables the organisation setting to force 2 factor authentication | None |
| `integration_data` | Integration config for different providers | [See Below](#integration_data) |
| `mailing_list` | Determines if mailing list consent is shown on signup | None |
| `max_api_calls_alert` | If enabled, shows an alert message in the top banner when the organization is over a 70% of its API calls limit | None |
| `oauth_github` | GitHub login key | [See Below](#oauth_github) |
| `oauth_google` | Google login key | [See Below](#oauth_google) |
| `payments_enabled` | Determines whether to show payment UI / seats | None |
| `plan_based_access` | Controls rbac and 2f based on plans | None |
| `rotate_api_token` | Enables the ability to rotate a user's access token | [See Below](#oauth_google) |
| `saml` | Enables SAML authentication | [See](/system-administration/authentication/SAML) |
| `segment_associated_features` | Enables the ability to see features associated with a segment | None |
| `segment_operators` | Determines what rules are shown when creating a segment | [See Below](#segment_operators) |
| `serverside_sdk_keys` | Enable Server-side Environment Keys | None |
| `show_role_management` | Show role management tab in OrganisationalSettingsPage | None |
| `sso_idp` | For self hosted, this will automatically redirect to the pre configured IdP | None |
| `tag_environments` | Enables an environment setting to add a UI hint to your environments (e.g. for prod) | None |
| `usage_chart` | Organisation Analytics usage chart - | None |
| `verify_seats_limit_for_invite_links` | Determines whether to show los invite links | None |

### `integration_data`

Expand Down
26 changes: 12 additions & 14 deletions frontend/common/stores/organisation-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,21 @@ const controller = {
API.trackEvent(Constants.events.CREATE_FIRST_PROJECT)
}
API.trackEvent(Constants.events.CREATE_PROJECT)
const defaultEnvironmentNames = Utils.getFlagsmithHasFeature('default_environment_names_for_new_project')
? JSON.parse(Utils.getFlagsmithValue('default_environment_names_for_new_project')) : ['Development', 'Production']
data
.post(`${Project.api}projects/`, { name, organisation: store.id })
.then((project) => {
Promise.all([
data
.post(`${Project.api}environments/`, {
name: 'Development',
project: project.id,
})
.then((res) => createSampleUser(res, 'development', project)),
data
.post(`${Project.api}environments/`, {
name: 'Production',
project: project.id,
})
.then((res) => createSampleUser(res, 'production', project)),
]).then((res) => {
Promise.all(
defaultEnvironmentNames.map((envName) => {
return data
.post(`${Project.api}environments/`, {
name: envName,
project: project.id,
})
.then((res) => createSampleUser(res, envName, project))
})
).then((res) => {
project.environments = res
store.model.projects = store.model.projects.concat(project)
store.savedId = {
Expand Down