Skip to content
This repository has been archived by the owner on Jan 24, 2023. It is now read-only.

Refactor setup config #3605

Closed
wants to merge 8 commits into from
Closed

Refactor setup config #3605

wants to merge 8 commits into from

Conversation

nwmac
Copy link
Contributor

@nwmac nwmac commented May 27, 2019

No description provided.

@nwmac nwmac self-assigned this May 27, 2019
@cfdreddbot
Copy link

✅ Hey nwmac! The commit authors and yourself have already signed the CLA.

@codecov
Copy link

codecov bot commented May 27, 2019

Codecov Report

Merging #3605 into v2-master will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           v2-master    #3605   +/-   ##
==========================================
  Coverage      51.42%   51.42%           
==========================================
  Files            725      725           
  Lines          20567    20567           
  Branches        3682     3682           
==========================================
  Hits           10577    10577           
  Misses          9990     9990

Copy link
Contributor

@richard-cox richard-cox left a comment

Choose a reason for hiding this comment

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

Just a few minor comments. Have tested running the backend with...

  • a fresh sqlite db and an existing old sqlite db
  • a fresh mariadb db and an existing old mariadb db
  • existing old postgres db cf service bound to a cf app (cf push with new code worked fine). Unfortunatly I couldn't directly access the db to confirm it's state but everything seems to work pre/post push of new code.

showStratosConfig(consoleConfig)
portalProxy.Config.ConsoleConfig = consoleConfig
setSSOFromConfig(portalProxy, consoleConfig)
portalProxy.Config.SSOLogin = consoleConfig.UseSSO
Copy link
Contributor

Choose a reason for hiding this comment

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

The gate on SSO_LOGIN has been lost. Is this checked later on or not needed now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can you expand what you mean by gate?

Copy link
Contributor

Choose a reason for hiding this comment

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

Previously, in the removed setSSOFromConfig, Config.SSOLogin was only set if !portalProxy.Env().IsSet("SSO_LOGIN") was true. Now it's always set. Was wondering this was a fix or omission

Copy link
Contributor Author

@nwmac nwmac Jun 18, 2019

Choose a reason for hiding this comment

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

This is a fix - previously these two somewhat competed - now they are backed by the same env var


var saveConsoleConfig = `INSERT INTO console_config (uaa_endpoint, console_admin_scope, console_client, console_client_secret, skip_ssl_validation, is_setup_complete, use_sso)
VALUES ($1, $2, $3, $4, $5, $6, $7)`
var deleteConsoleConfig = `DELETE FROM console_config`
Copy link
Contributor

Choose a reason for hiding this comment

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

I couldn't find where this is used. Should we be deleting the content on migration? For the next release should we nuke the table (assuming we only support point to point upgrades)?


// Get the current value from the enfironment
if currentValue, ok := envLookup.Lookup(envVarName); ok {
shouldStore = currentValue != value
Copy link
Contributor

Choose a reason for hiding this comment

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

Think this also needs some kind of falsy == falsy check. When running the new code against an old sqlite console_config table it migrates CONSOLE_CLIENT_SECRET with an empty value. This is the only value in the new config table. Guessing this is due to a nil and an empty string or something?
Update: CONSOLE_CLIENT_SECRET didn't exist in either config.properties or default config.properties.

}

if config == nil {
log.Info("Can not migrate setup data - setup table is empty")
Copy link
Contributor

Choose a reason for hiding this comment

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

Need to also run configStore.DeleteValue(systemGroupName, configSetupNeededMarker) here. Saw an issue where on a fresh db (mysql) the __CONFIG_MIGRATION_NEEDED remained and console_config migration ran on start up each time

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed

@richard-cox richard-cox added the needs attention This PR needs attention label May 29, 2019
@nwmac nwmac added comments-addressed ready for review and removed needs attention This PR needs attention labels Jun 19, 2019
@nwmac nwmac added the conflicts Merge conflicts on PR label Jul 7, 2019
@nwmac nwmac mentioned this pull request Jul 15, 2019
@nwmac
Copy link
Contributor Author

nwmac commented Jul 17, 2019

Closed in favour of other PR

@nwmac nwmac closed this Jul 17, 2019
@nwmac nwmac deleted the refactor-setup-config branch April 10, 2020 11:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants