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/refactor: filestore feature flag #4617

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

Conversation

Schwehn42
Copy link
Collaborator

@Schwehn42 Schwehn42 commented Nov 8, 2024

Description

Wraps the experimental file store (#4600) inside a feature flag.

Changelog

  • moved file store code to router.go, so it only gets executed once
  • add new flag/env var SCRUMLR_ENABLE_EXPERIMENTAL_AUTH_FILE_SYSTEM_STORE
  • use file store if env var is set to true
  • add docs

Testing

You can test if it works by adding this code:

func logTmpDir() {
	// Get the temporary directory path
	tempDir := os.TempDir()
	logger.Get().Infow("Temporary Directory", "dir", tempDir)

	// List files in the temporary directory
	files, err := ioutil.ReadDir(tempDir)
	if err != nil {
		logger.Get().Fatalw("Unable to read temporary directory", "error", err)
	}

	// Output the list of files
	logger.Get().Info("Files in temporary directory:")
	for _, file := range files {
		filePath := filepath.Join(tempDir, file.Name())
		logger.Get().Infow("File", "path", filePath, "size", file.Size(), "mod", file.ModTime())

		// Read and print the file contents
		contents, err := ioutil.ReadFile(filePath)
		if err != nil {
			logger.Get().Errorw("Unable to read file", "path", filePath, "error", err)
			continue
		}

		logger.Get().Infow("File contents", "path", filePath, "contents", contents)
	}
}

func logSessionData(w http.ResponseWriter, r *http.Request) {
	// Access the session store
	session, err := gothic.Store.Get(r, gothic.SessionName)
	if err != nil {
		logger.Get().Errorw("Error retrieving session", "error", err)
		return
	}

	logger.Get().Infow("Session", "ID", session.ID)
	// Log all session values
	for key, value := range session.Values {
		logger.Get().Infow("Session", "key", key, "value", value)
	}

	logTmpDir()
}

And calling the functions in both beginAuthProviderVerification and verifyAuthProviderCallback. If enabled, you should a file is temporarily created during OAuth process.

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas

@Schwehn42 Schwehn42 added the Review Needed This pull request is ready for review label Nov 8, 2024
@Schwehn42 Schwehn42 self-assigned this Nov 8, 2024
Copy link

octomind-dev bot commented Nov 8, 2024

🐙 Octomind

Test Report: 14/14 successful.

description status details
About Section Visibility Test Passed ✅ click
change avatar Passed ✅ click
check Privacy Policy Passed ✅ click
check terms & conditions Passed ✅ click
close cookie banner - front page Passed ✅ click
close cookie banner - sign-in Passed ✅ click
create and delete board columns Passed ✅ click
create_and_delete_notes_and_actions_v2 Passed ✅ click
create lean coffee board Passed ✅ click
edit_notes_and_actions_v5 Passed ✅ click
get started Passed ✅ click
share_session Passed ✅ click
sign-in Passed ✅ click
test all ways to open the setup flow Passed ✅ click

commit sha: 301f67f

@Schwehn42 Schwehn42 added Blocked This pull request or issue is currently blocked by another issue and removed Review Needed This pull request is ready for review labels Nov 20, 2024
@Schwehn42 Schwehn42 added Review Needed This pull request is ready for review and removed Blocked This pull request or issue is currently blocked by another issue labels Nov 27, 2024
Copy link

The deployment to the dev cluster was successful. You can find the deployment here: https://4617.development.scrumlr.fra.ics.inovex.io
This deployment is only for testing purposes and will be deleted after 1 week.
To redeploy rerun the workflow.
DO NOT STORE IMPORTANT DATA ON THIS DEPLOYMENT

Deployed Images
  • ghcr.io/inovex/scrumlr.io/scrumlr-frontend:sha-ecbe72d

  • ghcr.io/inovex/scrumlr.io/scrumlr-server:sha-ecbe72d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Review Needed This pull request is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant