文档

config(管理配置文件)

更新时间:

您可以通过config命令创建配置文件,用于存储配置项和访问凭证。config命令分为交互式命令和非交互式命令,您可以按需进行设置。

创建配置文件

ossutil config

该命令为交互式命令,用于快速设置缺省参数,即在[default]节里设置长期凭证和地域。

ossutil config
The command creates a config file and stores configuration settings and credentials.

Please enter the config file name,the file name can include path(default "C:\Users\issuser\.ossutilconfig", carriage return will use the default file. If you specified this option to other file, you should specify --config-file option to the file when you use other commands):

No config file entered, will use the default config file "C:\Users\issuser\.ossutilconfig"For the following settings, carriage return means skip the configuration.
Please enter Access Key ID [None]:
Please enter Access Key Secret [None]:
Please enter Region [cn-hangzhou]:

设置和查看配置设置

设置配置设置

ossutil config set

该命令为非交互式命令,设置凭证或配置设置。通过--config-file指定配置文件路径,通过--profile指定 [profile xxx]。

例如,以下命令设置myconfig文件中,dev节的region参数。

ossutil config set region cn-hangzhou --config-file myconfig --profile dev

要删除某个设置,请使用空字符串作为值,或在文本编辑器中手动从删除该设置。

ossutil config set region cn-hangzhou --config-file myconfig --profile dev

获取配置设置

ossutil config get

该命令为非交互式命令,查看凭证或配置设置。通过--config-file指定配置文件路径,通过--profile指定节名。例如,以下命令查看myconfig文件中,dev节的region参数。

ossutil config get region --config-file myconfig --profile dev

列出所有配置名称

该命令为非交互式命令,列出所有节的名称。

ossutil config list-profiles

快速创建或配置访问凭证

ossutil c   onfig credential

该命令为交互式命令,用于快速创建访问凭证设置。其中AK/SK/Token三个参数会涉及用户是否需要加密。

ossutil config credential
The command creates a config file and stores configuration settings and credentials.

Please enter the config file name,the file name can include path(default "C:\Users\issuser\.ossutilconfig", carriage return will use the default file. If you specified this option to other file, you should specify --config-file option to the file when you use other commands):

No config file entered, will use the default config file "C:\Users\issuser\.ossutilconfig"For the following settings, carriage return means skip the configuration.
Please enter profile:
Please enter authenticate mode, supports RamRoleArn,EcsRamRole,Process,Uri,OIDCRoleArn,AK,StsToken:
Do you need to encryt access key id and access key secret (y or N)
Please enter Access Key ID [None]:
Please enter Access Key Secret [None]: