cli icon indicating copy to clipboard operation
cli copied to clipboard

Add capability to specify a custom folder when using dapr init --slim command

Open GFlisch opened this issue 2 years ago • 5 comments

Describe the proposal

It is possible to install the CLI on a specific folder but not the dapr.exe.

The code uses always the DefaultConfigFilePath() which is using the homeDir, _ := os.UserHomeDir().

I would like to have a capability to specify another "home" directory. The company where I am working we have not the right to install non signed exe anywhere and we are not admin of our pc. But we have an open door on a specific folder where we can (letting us still developing something 🙄).

Is it something you can imagine?

The work around is to temporarily change the home environment variable before running the dapr init --slim command.

func createSlimConfiguration(wg *sync.WaitGroup, errorChan chan<- error, info initInfo) { defer wg.Done()

if !info.slimMode {
	return
}

// For --slim we pass empty string so that we do not configure zipkin.
err := createDefaultConfiguration("", DefaultConfigFilePath())
if err != nil {
	errorChan <- fmt.Errorf("error creating default configuration file: %w", err)
	return
}

}

RELEASE NOTE:

ADD custom installation directory for dapr init --slim command.

GFlisch avatar Jun 22 '22 05:06 GFlisch

Another flag could be added to dapr init for specifying custom folder which will be used instead of HomeDir to install dapr binaries as well as config files etc. Something like dapr init --dapr-dir <path_to_local_dir>

shivamkm07 avatar Jul 13 '22 05:07 shivamkm07

The issue here is dapr always looks to a particular path ~/.dapr/bin for the daprd binary. If it is installed in some other location, each time dapr CLI is run, then it would need to know where the binary is installed at. This needs more discussion.

mukundansundar avatar Jul 13 '22 05:07 mukundansundar

Hi @mukundansundar, could we imagine to add another environment variable only when this feature --dapr-dir is added. In this case the dapr exe can check if the environment variable exists. If not it can take the default one ~/.dapr/bin?

GFlisch avatar Jul 13 '22 05:07 GFlisch

Just looked at the code - dapr run command is picking the bin dir from https://github.com/dapr/cli/blob/747dc3f7aeeb525e1f71762e4986bd0e11f54442/pkg/standalone/run.go#L293

https://github.com/dapr/cli/blob/747dc3f7aeeb525e1f71762e4986bd0e11f54442/pkg/standalone/common.go#L30

So, it seems if we provide an alternate install path then dapr run should pick the binary correctly ?

pravinpushkar avatar Jul 13 '22 06:07 pravinpushkar

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue, help wanted or triaged/resolved) or other activity occurs. Thank you for your contributions.

dapr-bot avatar Aug 12 '22 06:08 dapr-bot

This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as pinned, good first issue, help wanted or triaged/resolved. Thank you for your contributions.

dapr-bot avatar Aug 19 '22 06:08 dapr-bot