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

Set CORS ALLOW_ORIGINS as ENV #1312

Merged
merged 1 commit into from
Aug 31, 2023
Merged

Conversation

seokho-son
Copy link
Member

Set CORS ALLOW_ORIGINS as ENV

>  # API Setting
>  # ALLOW_ORIGINS (ex: https://cloud-barista.org,xxx.xxx.xxx.xxx,*)
allowedOrigins := os.Getenv("ALLOW_ORIGINS")
	if allowedOrigins == "" {
		log.Fatal("ALLOW_ORIGINS env variable for CORS is " + allowedOrigins +
			". Please provide a proper value and source setup.env again. EXITING...")
		// allowedOrigins = "*"
	}
	e.Use(middleware.CORSWithConfig(middleware.CORSConfig{
		AllowOrigins: []string{allowedOrigins},
		AllowMethods: []string{http.MethodGet, http.MethodPut, http.MethodPost, http.MethodDelete},
	}))

@seokho-son
Copy link
Member Author

/approve

@seokho-son seokho-son merged commit 4e7a8b5 into cloud-barista:main Aug 31, 2023
1 check passed
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.

1 participant