Skip to content

Commit

Permalink
Refine env variable for bool. v5.11.7
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Oct 28, 2023
1 parent 755b1e7 commit 3d2de29
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
18 changes: 9 additions & 9 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Run the platform backend, or run in GoLand:
(cd platform && go run .)
```

> Note: Set `AUTO_SELF_SIGNED_CERTIFICATE=true` if need to generate self-signed certificate.
> Note: Set `AUTO_SELF_SIGNED_CERTIFICATE=on` if need to generate self-signed certificate.
Run all tests:

Expand Down Expand Up @@ -870,12 +870,12 @@ The optional environments defined by `platform/containers/data/config/.env`:

For feature control:

* `NAME_LOOKUP`: Whether enable the host name lookup, true or false. Default: false
* `NAME_LOOKUP`: `on|off`, whether enable the host name lookup, on or off. Default: off

For testing the specified service:

* `NODE_ENV`: `development|production`, if development, use local redis; otherwise, use `mgmt.srs.local` in docker.
* `LOCAL_RELEASE`: `true|false`, whether use local release service.
* `LOCAL_RELEASE`: `on|off`, whether use local release service. Default: off

For mgmt and containers to connect to redis:

Expand All @@ -895,16 +895,16 @@ Removed variables in .env:

For HTTPS, automatically generate a self-signed certificate:

* `AUTO_SELF_SIGNED_CERTIFICATE`: `true|false`, whether generate self-signed certificate.
* `AUTO_SELF_SIGNED_CERTIFICATE`: `on|off`, whether generate self-signed certificate.

Deprecated and unused variables:

* `SRS_DOCKERIZED`: `true|false` Indicates the OS is in docker.
* `SRS_DOCKERIZED`: `on|off`, indicates the OS is in docker.
* `SRS_DOCKER`: `srs` to enfore use `ossrs/srs` docker image.
* `MGMT_DOCKER`: Whether run mgmt in docker. Default: false
* `PLATFORM_DOCKER`: Whether run platform in docker. Default: true
* `USE_DOCKER`: `true|false`, if false, disable all docker containers.
* `SRS_UTEST`: `true|false`, if true, running in utest mode.
* `MGMT_DOCKER`: `on|off`, whether run mgmt in docker. Default: false
* `PLATFORM_DOCKER`: `on|off`, whether run platform in docker. Default: on
* `USE_DOCKER`: `on|off`, if false, disable all docker containers.
* `SRS_UTEST`: `on|off`, if on, running in utest mode.
* `SOURCE`: `github|gitee`, The source code for upgrading.

Please restart service when `.env` changed.
2 changes: 1 addition & 1 deletion platform/candidate.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (v *CandidateWorker) Start(ctx context.Context) error {
// set env NAME_LOOKUP to false.
func (v *CandidateWorker) Resolve(host string) (net.IP, error) {
// Ignore the resolving.
if os.Getenv("NAME_LOOKUP") == "false" {
if os.Getenv("NAME_LOOKUP") == "off" {
return nil, nil
}

Expand Down
2 changes: 1 addition & 1 deletion platform/cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func NewCertManager() *CertManager {
}

func (v *CertManager) Initialize(ctx context.Context) error {
if os.Getenv("AUTO_SELF_SIGNED_CERTIFICATE") == "true" {
if os.Getenv("AUTO_SELF_SIGNED_CERTIFICATE") == "on" {
if err := v.createSelfSignCertificate(ctx); err != nil {
return errors.Wrapf(err, "create self-signed certificate")
}
Expand Down
6 changes: 3 additions & 3 deletions platform/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@ func doMain(ctx context.Context) error {
// Migrate from mgmt.
setEnvDefault("REDIS_PORT", "6379")
setEnvDefault("MGMT_LISTEN", "2022")
setEnvDefault("PLATFORM_DOCKER", "true")
setEnvDefault("PLATFORM_DOCKER", "on")

// For HTTPS.
setEnvDefault("HTTPS_LISTEN", "2443")
setEnvDefault("AUTO_SELF_SIGNED_CERTIFICATE", "false")
setEnvDefault("AUTO_SELF_SIGNED_CERTIFICATE", "off")

// For feature control.
setEnvDefault("NAME_LOOKUP", "false")
setEnvDefault("NAME_LOOKUP", "off")

logger.Tf(ctx, "load .env as MGMT_PASSWORD=%vB, "+
"SRS_PLATFORM_SECRET=%vB, CLOUD=%v, REGION=%v, SOURCE=%v, "+
Expand Down
2 changes: 1 addition & 1 deletion platform/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func queryLatestVersion(ctx context.Context) (*Versions, error) {
params["version"] = version
params["ts"] = fmt.Sprintf("%v", time.Now().UnixNano()/int64(time.Millisecond))
releaseServer := "https://api.ossrs.net"
if os.Getenv("LOCAL_RELEASE") != "" {
if os.Getenv("LOCAL_RELEASE") == "on" {
releaseServer = "http://localhost:2023"
}
logger.Tf(ctx, "Query %v with %v", releaseServer, params)
Expand Down

0 comments on commit 3d2de29

Please sign in to comment.