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

Configuration is not read from the .okta.yaml file in the application or project's root directory #349

Open
burimbd opened this issue Nov 29, 2022 · 3 comments · May be fixed by #382
Open
Labels
bug Something isn't working stale

Comments

@burimbd
Copy link

burimbd commented Nov 29, 2022

Describe the bug?

The configuration reader for the .okta.yaml file does not read in the applications or project's root directory APPorProjectRootDir, but instead get the file from the directory where the github.com/okta/okta-sdk-golang/v2@v2.14.0 is installed. In my case it tries to get the config file from "~/go/pkg/mod/github.com/okta/okta-sdk-golang/v2@v2.14.0/.okta.yaml".

What is expected to happen?

Based on documentation the configuration file should be retrieved from A .okta.yaml file in the application or project's root directory. I would expect that file to be on my projects root directory and not that of okta's package.

What is the actual behavior?

Sdk tries to read the config file from the okta package installation location : "~/go/pkg/mod/github.com/okta/okta-sdk-golang/v2@v2.14.0/.okta.yaml"

Reproduction Steps?

  1. Create a folder called test
  2. Run go mod init from inside the folder
  3. Run go get github.com/okta/okta-sdk-golang/v2/okta from inside the folder
  4. Create a .okta.yaml file inside the folder with the following content:
okta:
  client:
    connectionTimeout: 30 # seconds
    orgUrl: "https://{yourOktaDomain}"
    proxy:
      port: null
      host: null
      username: null
      password: null
    token: {apiToken}
  1. Create a main.go file with the following content:
package main

import (
	"context"
	"fmt"

	"github.com/okta/okta-sdk-golang/v2/okta"
)

func main() {
	ctx, client, err := okta.NewClient(
		context.TODO(),
	)

	if err != nil {
		fmt.Printf("Error: %v\n", err)
	}

	fmt.Printf("Context: %+v\n Client: %+v\n", ctx, client)
}
  1. Run the package with go run main.go and will get the following output:
Error: your Okta API token is missing. You can generate one in the Okta Developer Console. Follow these instructions: https://bit.ly/get-okta-api-token
Context: <nil>
 Client: <nil>

Additional Information?

No response

Golang Version

go version go1.19.3 linux/amd64

SDK Version

github.com/okta/okta-sdk-golang/v2 v2.14.0

OS version

PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

@burimbd burimbd added the bug Something isn't working label Nov 29, 2022
@github-actions
Copy link

This issue has been marked stale because there has been no activity within the last 14 days. To keep this issue active, remove the stale label.

@github-actions github-actions bot added the stale label Dec 13, 2022
@monde monde removed the stale label Feb 13, 2023
@github-actions
Copy link

This issue has been marked stale because there has been no activity within the last 14 days. To keep this issue active, remove the stale label.

@github-actions github-actions bot added the stale label Feb 28, 2023
@ConnorWidtfeldt ConnorWidtfeldt linked a pull request May 31, 2023 that will close this issue
11 tasks
@monde monde removed the stale label Jun 6, 2023
@github-actions
Copy link

This issue has been marked stale because there has been no activity within the last 14 days. To keep this issue active, remove the stale label.

@github-actions github-actions bot added the stale label Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants