Compare commits
No commits in common. "server" and "master" have entirely different histories.
@ -5,8 +5,7 @@ config :bump, Bump.Repo,
|
|||||||
username: "postgres",
|
username: "postgres",
|
||||||
password: "postgres",
|
password: "postgres",
|
||||||
database: "bump_dev",
|
database: "bump_dev",
|
||||||
hostname: "database",
|
hostname: "tower.local",
|
||||||
port: 5555,
|
|
||||||
show_sensitive_data_on_connection_error: true,
|
show_sensitive_data_on_connection_error: true,
|
||||||
pool_size: 10
|
pool_size: 10
|
||||||
|
|
||||||
@ -19,7 +18,7 @@ config :bump, Bump.Repo,
|
|||||||
config :bump, BumpWeb.Endpoint,
|
config :bump, BumpWeb.Endpoint,
|
||||||
# Binding to loopback ipv4 address prevents access from other machines.
|
# Binding to loopback ipv4 address prevents access from other machines.
|
||||||
# Change to `ip: {0, 0, 0, 0}` to allow access from other machines.
|
# Change to `ip: {0, 0, 0, 0}` to allow access from other machines.
|
||||||
http: [ip: {0, 0, 0, 0}, port: 4012],
|
http: [ip: {0, 0, 0, 0}, port: 4000],
|
||||||
check_origin: false,
|
check_origin: false,
|
||||||
code_reloader: true,
|
code_reloader: true,
|
||||||
debug_errors: true,
|
debug_errors: true,
|
||||||
|
@ -1,15 +1,5 @@
|
|||||||
import Config
|
import Config
|
||||||
|
|
||||||
# Configure your database
|
|
||||||
config :bump, Bump.Repo,
|
|
||||||
username: "postgres",
|
|
||||||
password: "postgres",
|
|
||||||
database: "bump_dev",
|
|
||||||
hostname: "database",
|
|
||||||
port: 5555,
|
|
||||||
show_sensitive_data_on_connection_error: false,
|
|
||||||
pool_size: 10
|
|
||||||
|
|
||||||
# For production, don't forget to configure the url host
|
# For production, don't forget to configure the url host
|
||||||
# to something meaningful, Phoenix uses this information
|
# to something meaningful, Phoenix uses this information
|
||||||
# when generating URLs.
|
# when generating URLs.
|
||||||
@ -20,16 +10,8 @@ config :bump, Bump.Repo,
|
|||||||
# which you should run after static files are built and
|
# which you should run after static files are built and
|
||||||
# before starting your production server.
|
# before starting your production server.
|
||||||
config :bump, BumpWeb.Endpoint,
|
config :bump, BumpWeb.Endpoint,
|
||||||
http: [ip: {0, 0, 0, 0}, port: 4012],
|
url: [host: "example.com", port: 80],
|
||||||
check_origin: false,
|
cache_static_manifest: "priv/static/cache_manifest.json"
|
||||||
code_reloader: false,
|
|
||||||
debug_errors: false,
|
|
||||||
cache_static_manifest: "priv/static/cache_manifest.json",
|
|
||||||
secret_key_base: "c/uw9+syw3QefW2JeS+JzMihBKTfVB6C4d/9cmStSynygaP91BLoxbPVedBJIU6p",
|
|
||||||
watchers: [
|
|
||||||
# Start the esbuild watcher by calling Esbuild.install_and_run(:default, args)
|
|
||||||
esbuild: {Esbuild, :install_and_run, [:default, ~w(--sourcemap=inline --watch)]}
|
|
||||||
]
|
|
||||||
|
|
||||||
# Do not print debug messages in production
|
# Do not print debug messages in production
|
||||||
config :logger, level: :info
|
config :logger, level: :info
|
||||||
|
@ -6,7 +6,7 @@ import Config
|
|||||||
# and secrets from environment variables or elsewhere. Do not define
|
# and secrets from environment variables or elsewhere. Do not define
|
||||||
# any compile-time configuration in here, as it won't be applied.
|
# any compile-time configuration in here, as it won't be applied.
|
||||||
# The block below contains prod specific runtime configuration.
|
# The block below contains prod specific runtime configuration.
|
||||||
if config_env() == :nothing do
|
if config_env() == :prod do
|
||||||
database_url =
|
database_url =
|
||||||
System.get_env("DATABASE_URL") ||
|
System.get_env("DATABASE_URL") ||
|
||||||
raise """
|
raise """
|
||||||
@ -39,7 +39,7 @@ if config_env() == :nothing do
|
|||||||
# See the documentation on https://hexdocs.pm/plug_cowboy/Plug.Cowboy.html
|
# See the documentation on https://hexdocs.pm/plug_cowboy/Plug.Cowboy.html
|
||||||
# for details about using IPv6 vs IPv4 and loopback vs public addresses.
|
# for details about using IPv6 vs IPv4 and loopback vs public addresses.
|
||||||
ip: {0, 0, 0, 0, 0, 0, 0, 0},
|
ip: {0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
port: String.to_integer(System.get_env("PORT") || "4012")
|
port: String.to_integer(System.get_env("PORT") || "4000")
|
||||||
],
|
],
|
||||||
secret_key_base: secret_key_base
|
secret_key_base: secret_key_base
|
||||||
|
|
||||||
|
@ -9,8 +9,7 @@ config :bump, Bump.Repo,
|
|||||||
username: "postgres",
|
username: "postgres",
|
||||||
password: "postgres",
|
password: "postgres",
|
||||||
database: "bump_test#{System.get_env("MIX_TEST_PARTITION")}",
|
database: "bump_test#{System.get_env("MIX_TEST_PARTITION")}",
|
||||||
hostname: "database",
|
hostname: "tower.local",
|
||||||
port: 5555,
|
|
||||||
pool: Ecto.Adapters.SQL.Sandbox,
|
pool: Ecto.Adapters.SQL.Sandbox,
|
||||||
pool_size: 10
|
pool_size: 10
|
||||||
|
|
||||||
|
@ -1 +0,0 @@
|
|||||||
Bump API
|
|
@ -9,13 +9,13 @@ defmodule Bump.Database do
|
|||||||
where: m.sender == ^sender,
|
where: m.sender == ^sender,
|
||||||
order_by: [desc: m.timestamp],
|
order_by: [desc: m.timestamp],
|
||||||
limit: 1,
|
limit: 1,
|
||||||
select: %{id: m.id, title: m.title, data: m.data, timestamp: m.timestamp}
|
select: %{id: m.id, data: m.data, timestamp: m.timestamp}
|
||||||
|
|
||||||
res = Repo.one(query)
|
res = Repo.one(query)
|
||||||
|
|
||||||
if not is_nil(res) do
|
if not is_nil(res) do
|
||||||
Repo.delete_all(from m in "messages", where: m.id == ^res.id)
|
Repo.delete_all(from m in "messages", where: m.id == ^res.id)
|
||||||
%{title: res.title, data: res.data, timestamp: res.timestamp}
|
%{data: res.data, timestamp: res.timestamp}
|
||||||
else
|
else
|
||||||
%{}
|
%{}
|
||||||
end
|
end
|
||||||
@ -27,7 +27,7 @@ defmodule Bump.Database do
|
|||||||
where: m.sender == ^sender,
|
where: m.sender == ^sender,
|
||||||
order_by: [desc: m.timestamp],
|
order_by: [desc: m.timestamp],
|
||||||
limit: 1,
|
limit: 1,
|
||||||
select: %{title: m.title, data: m.data, timestamp: m.timestamp}
|
select: %{data: m.data, timestamp: m.timestamp}
|
||||||
Repo.one(query)
|
Repo.one(query)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ defmodule Bump.Database do
|
|||||||
query = from m in "messages",
|
query = from m in "messages",
|
||||||
where: m.sender == ^sender and
|
where: m.sender == ^sender and
|
||||||
m.timestamp >= ^ago,
|
m.timestamp >= ^ago,
|
||||||
select: %{title: m.title, data: m.data, timestamp: m.timestamp}
|
select: %{data: m.data, timestamp: m.timestamp}
|
||||||
|
|
||||||
Repo.all(query)
|
Repo.all(query)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user