Skip to content

Commit

Permalink
fix: Switch default instance from Heroku to Railway following https:/…
Browse files Browse the repository at this point in the history
  • Loading branch information
pojntfx committed Nov 27, 2022
1 parent e5eedbb commit f1e2f45
Show file tree
Hide file tree
Showing 14 changed files with 68 additions and 68 deletions.
52 changes: 26 additions & 26 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cmd/weron/cmd/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ var chatCmd = &cobra.Command{
}

func init() {
chatCmd.PersistentFlags().String(raddrFlag, "wss://weron.herokuapp.com/", "Remote address")
chatCmd.PersistentFlags().String(raddrFlag, "wss://weron.up.railway.app/", "Remote address")
chatCmd.PersistentFlags().Duration(timeoutFlag, time.Second*10, "Time to wait for connections")
chatCmd.PersistentFlags().String(communityFlag, "", "ID of community to join")
chatCmd.PersistentFlags().String(passwordFlag, "", "Password for community")
Expand Down
2 changes: 1 addition & 1 deletion cmd/weron/cmd/manager_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
var managerDeleteCmd = &cobra.Command{
Use: "delete",
Aliases: []string{"del", "d", "rm"},
Short: "Delete a persistent or ephermal community",
Short: "Delete a persistent or ephemeral community",
PreRunE: validateRemoteFlags,
RunE: func(cmd *cobra.Command, args []string) error {
if err := viper.BindPFlags(cmd.PersistentFlags()); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions cmd/weron/cmd/manager_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var (
var managerListCmd = &cobra.Command{
Use: "list",
Aliases: []string{"lis", "l", "ls"},
Short: "List persistent and ephermal communities",
Short: "List persistent and ephemeral communities",
PreRunE: validateRemoteFlags,
RunE: func(cmd *cobra.Command, args []string) error {
if err := viper.BindPFlags(cmd.PersistentFlags()); err != nil {
Expand Down Expand Up @@ -86,7 +86,7 @@ func init() {
func addRemoteFlags(f *pflag.FlagSet) {
f.String(apiUsernameFlag, "admin", "Username for the management API (can also be set using the API_USERNAME env variable). Ignored if any of the OIDC parameters are set.")
f.String(apiPasswordFlag, "", "Password for the management API (can also be set using the API_PASSWORD env variable). Ignored if any of the OIDC parameters are set.")
f.String(raddrFlag, "https://weron.herokuapp.com/", "Remote address")
f.String(raddrFlag, "https://weron.up.railway.app/", "Remote address")
}

func validateRemoteFlags(cmd *cobra.Command, args []string) error {
Expand Down
38 changes: 19 additions & 19 deletions cmd/weron/cmd/signaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ import (
)

const (
laddrFlag = "laddr"
heartbeatFlag = "heartbeat"
postgresURLFlag = "postgres-url"
redisURLFlag = "redis-url"
cleanupFlag = "cleanup"
ephermalCommunitiesFlag = "ephermal-communities"
apiUsernameFlag = "api-username"
apiPasswordFlag = "api-password"
oidcIssuerFlag = "oidc-issuer"
oidcClientIDFlag = "oidc-client-id"
laddrFlag = "laddr"
heartbeatFlag = "heartbeat"
postgresURLFlag = "postgres-url"
redisURLFlag = "redis-url"
cleanupFlag = "cleanup"
ephemeralCommunitiesFlag = "ephemeral-communities"
apiUsernameFlag = "api-username"
apiPasswordFlag = "api-password"
oidcIssuerFlag = "oidc-issuer"
oidcClientIDFlag = "oidc-client-id"
)

var signalerCmd = &cobra.Command{
Expand Down Expand Up @@ -99,13 +99,13 @@ var signalerCmd = &cobra.Command{
viper.GetString(postgresURLFlag),
viper.GetString(redisURLFlag),
&wrtcsgl.SignalerConfig{
Heartbeat: viper.GetDuration(heartbeatFlag),
Cleanup: viper.GetBool(cleanupFlag),
EphermalCommunities: viper.GetBool(ephermalCommunitiesFlag),
APIUsername: viper.GetString(apiUsernameFlag),
APIPassword: viper.GetString(apiPasswordFlag),
OIDCIssuer: viper.GetString(oidcIssuerFlag),
OIDCClientID: viper.GetString(oidcClientIDFlag),
Heartbeat: viper.GetDuration(heartbeatFlag),
Cleanup: viper.GetBool(cleanupFlag),
EphemeralCommunities: viper.GetBool(ephemeralCommunitiesFlag),
APIUsername: viper.GetString(apiUsernameFlag),
APIPassword: viper.GetString(apiPasswordFlag),
OIDCIssuer: viper.GetString(oidcIssuerFlag),
OIDCClientID: viper.GetString(oidcClientIDFlag),
OnConnect: func(raddr, community string) {
log.Info().
Str("address", raddr).
Expand Down Expand Up @@ -140,8 +140,8 @@ func init() {
signalerCmd.PersistentFlags().Duration(heartbeatFlag, time.Second*10, "Time to wait for heartbeats")
signalerCmd.PersistentFlags().String(postgresURLFlag, "", "URL of PostgreSQL database to use (i.e. postgres://myuser:mypassword@myhost:myport/mydatabase) (can also be set using the DATABASE_URL env variable). If empty, a in-memory database will be used.")
signalerCmd.PersistentFlags().String(redisURLFlag, "", "URL of Redis database to use (i.e. redis://myuser:mypassword@myhost:myport/1) (can also be set using the REDIS_URL env variable). If empty, a in-process broker will be used.")
signalerCmd.PersistentFlags().Bool(cleanupFlag, false, "(Warning: Only enable this after stopping all other servers accessing the database!) Remove all ephermal communities from database and reset client counts before starting")
signalerCmd.PersistentFlags().Bool(ephermalCommunitiesFlag, true, "Enable the creation of ephermal communities")
signalerCmd.PersistentFlags().Bool(cleanupFlag, false, "(Warning: Only enable this after stopping all other servers accessing the database!) Remove all ephemeral communities from database and reset client counts before starting")
signalerCmd.PersistentFlags().Bool(ephemeralCommunitiesFlag, true, "Enable the creation of ephemeral communities")
signalerCmd.PersistentFlags().String(apiUsernameFlag, "admin", "Username for the management API (can also be set using the API_USERNAME env variable). Ignored if any of the OIDC parameters are set.")
signalerCmd.PersistentFlags().String(apiPasswordFlag, "", "Password for the management API (can also be set using the API_PASSWORD env variable). Ignored if any of the OIDC parameters are set.")
signalerCmd.PersistentFlags().String(oidcIssuerFlag, "", "OIDC Issuer (i.e. https://pojntfx.eu.auth0.com/) (can also be set using the OIDC_ISSUER env variable)")
Expand Down
2 changes: 1 addition & 1 deletion cmd/weron/cmd/utility_latency.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ var utilityLatencyCommand = &cobra.Command{
}

func init() {
utilityLatencyCommand.PersistentFlags().String(raddrFlag, "wss://weron.herokuapp.com/", "Remote address")
utilityLatencyCommand.PersistentFlags().String(raddrFlag, "wss://weron.up.railway.app/", "Remote address")
utilityLatencyCommand.PersistentFlags().Duration(timeoutFlag, time.Second*10, "Time to wait for connections")
utilityLatencyCommand.PersistentFlags().String(communityFlag, "", "ID of community to join")
utilityLatencyCommand.PersistentFlags().String(passwordFlag, "", "Password for community")
Expand Down
2 changes: 1 addition & 1 deletion cmd/weron/cmd/utility_throughput.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ var utilityThroughputCmd = &cobra.Command{
}

func init() {
utilityThroughputCmd.PersistentFlags().String(raddrFlag, "wss://weron.herokuapp.com/", "Remote address")
utilityThroughputCmd.PersistentFlags().String(raddrFlag, "wss://weron.up.railway.app/", "Remote address")
utilityThroughputCmd.PersistentFlags().Duration(timeoutFlag, time.Second*10, "Time to wait for connections")
utilityThroughputCmd.PersistentFlags().String(communityFlag, "", "ID of community to join")
utilityThroughputCmd.PersistentFlags().String(passwordFlag, "", "Password for community")
Expand Down
2 changes: 1 addition & 1 deletion cmd/weron/cmd/vpn_ethernet.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ var vpnEthernetCmd = &cobra.Command{
}

func init() {
vpnEthernetCmd.PersistentFlags().String(raddrFlag, "wss://weron.herokuapp.com/", "Remote address")
vpnEthernetCmd.PersistentFlags().String(raddrFlag, "wss://weron.up.railway.app/", "Remote address")
vpnEthernetCmd.PersistentFlags().Duration(timeoutFlag, time.Second*10, "Time to wait for connections")
vpnEthernetCmd.PersistentFlags().String(communityFlag, "", "ID of community to join")
vpnEthernetCmd.PersistentFlags().String(passwordFlag, "", "Password for community")
Expand Down
2 changes: 1 addition & 1 deletion cmd/weron/cmd/vpn_ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ var vpnIPCmd = &cobra.Command{
}

func init() {
vpnIPCmd.PersistentFlags().String(raddrFlag, "wss://weron.herokuapp.com/", "Remote address")
vpnIPCmd.PersistentFlags().String(raddrFlag, "wss://weron.up.railway.app/", "Remote address")
vpnIPCmd.PersistentFlags().Duration(timeoutFlag, time.Second*10, "Time to wait for connections")
vpnIPCmd.PersistentFlags().String(communityFlag, "", "ID of community to join")
vpnIPCmd.PersistentFlags().String(passwordFlag, "", "Password for community")
Expand Down
2 changes: 1 addition & 1 deletion examples/weron-echo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var (

func main() {
verboseFlag := flag.Int("verbose", 5, "Verbosity level (0 is disabled, default is info, 7 is trace)")
raddrFlag := flag.String("raddr", "wss://weron.herokuapp.com/", "Remote address")
raddrFlag := flag.String("raddr", "wss://weron.up.railway.app/", "Remote address")
timeoutFlag := flag.Duration("timeout", time.Second*10, "Time to wait for connections")
communityFlag := flag.String("community", "", "ID of community to join")
passwordFlag := flag.String("password", "", "Password for community")
Expand Down
2 changes: 1 addition & 1 deletion internal/persisters/communities.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

var (
ErrEphermalCommunitiesDisabled = errors.New("creation of ephermal communites is disabled")
ErrEphemeralCommunitiesDisabled = errors.New("creation of ephemeral communites is disabled")
)

type Community struct {
Expand Down
2 changes: 1 addition & 1 deletion internal/persisters/memory/communities.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func (p *CommunitiesPersister) Cleanup(

newCommunities := []*Community{}
for _, candidate := range p.communities {
// Delete all ephermal communities
// Delete all ephemeral communities
if candidate.Persistent {
continue
}
Expand Down
4 changes: 2 additions & 2 deletions internal/persisters/psql/communities.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (p *CommunitiesPersister) AddClientsToCommunity(
return err
}

return persisters.ErrEphermalCommunitiesDisabled
return persisters.ErrEphemeralCommunitiesDisabled
}

c = &models.Community{
Expand Down Expand Up @@ -191,7 +191,7 @@ func (p *CommunitiesPersister) Cleanup(
return err
}

// Delete all ephermal communities
// Delete all ephemeral communities
if _, err := models.Communities(qm.Where(models.CommunityColumns.Persistent+"= ?", false)).DeleteAll(ctx, tx); err != nil {
if err := tx.Rollback(); err != nil {
return err
Expand Down
20 changes: 10 additions & 10 deletions pkg/wrtcsgl/wrtcsgl.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ type connection struct {

// SignalerConfig configures the adapter
type SignalerConfig struct {
Heartbeat time.Duration // Duration between heartbeats
Cleanup bool // Whether to cleanup leftover ephermal communities before starting
EphermalCommunities bool // Whether to enable ephermal communities
APIUsername string // Username for the API endpoint
APIPassword string // Password for the API endpoint; ignored if any of the OIDC parameters are set
OIDCIssuer string // OpenID Connect issuer
OIDCClientID string // OpenID Connect client id
Heartbeat time.Duration // Duration between heartbeats
Cleanup bool // Whether to cleanup leftover ephemeral communities before starting
EphemeralCommunities bool // Whether to enable ephemeral communities
APIUsername string // Username for the API endpoint
APIPassword string // Password for the API endpoint; ignored if any of the OIDC parameters are set
OIDCIssuer string // OpenID Connect issuer
OIDCClientID string // OpenID Connect client id

OnConnect func(raddr string, community string) // Handler to be called when a client has connected to the signaler
OnDisconnect func(raddr string, community string, err interface{}) // Handler to be called when a client has disconnected from the signaler
Expand Down Expand Up @@ -224,14 +224,14 @@ func (s *Signaler) Open() error {
return
}

// Create ephermal community
// Create ephemeral community
password := r.URL.Query().Get("password")
if strings.TrimSpace(password) == "" {
panic(errMissingPassword)
}

if err := s.db.AddClientsToCommunity(s.ctx, community, password, s.config.EphermalCommunities); err != nil {
if err == authn.ErrWrongPassword || err == persisters.ErrEphermalCommunitiesDisabled {
if err := s.db.AddClientsToCommunity(s.ctx, community, password, s.config.EphemeralCommunities); err != nil {
if err == authn.ErrWrongPassword || err == persisters.ErrEphemeralCommunitiesDisabled {
rw.WriteHeader(http.StatusUnauthorized)

panic(fmt.Errorf("%v", http.StatusUnauthorized))
Expand Down

0 comments on commit f1e2f45

Please sign in to comment.