Skip to content

Commit

Permalink
Add .formatter.exs. Run mix format on all files
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanIvanoff committed Jan 31, 2018
1 parent bb71f4e commit 6874206
Show file tree
Hide file tree
Showing 191 changed files with 3,125 additions and 2,176 deletions.
12 changes: 12 additions & 0 deletions .formatter.exs
@@ -0,0 +1,12 @@
[
inputs: [
"config/*.{ex,exs}",
"lib/*.{ex,exs}",
"lib/**/*.{ex,exs}",
"test/*.{ex,exs}",
"test/**/*.{ex,exs}",
"priv/**/*.{ex,exs}",
"mix.exs",
".formatter.exs"
]
]
46 changes: 24 additions & 22 deletions config/config.exs
Expand Up @@ -6,8 +6,7 @@
use Mix.Config

# General application configuration
config :sanbase,
ecto_repos: [Sanbase.Repo]
config :sanbase, ecto_repos: [Sanbase.Repo]

config :sanbase, Sanbase.Repo,
adapter: Ecto.Adapters.Postgres,
Expand All @@ -19,8 +18,7 @@ config :sanbase, SanbaseWeb.Endpoint,
url: [host: "localhost"],
secret_key_base: "Vq7Rfo0T4EfiLX2/ryYal3O0l9ebBNhyh58cfWdTAUHxEJGu2p9u1WTQ31Ki4Phj",
render_errors: [view: SanbaseWeb.ErrorView, accepts: ~w(json)],
pubsub: [name: Sanbase.PubSub,
adapter: Phoenix.PubSub.PG2]
pubsub: [name: Sanbase.PubSub, adapter: Phoenix.PubSub.PG2]

# Do not log SASL crash reports
config :sasl, sasl_error_logger: false
Expand All @@ -35,18 +33,18 @@ config :logger, :console,
# Error tracking
config :sentry,
included_environments: [:prod],
environment_name: Mix.env
environment_name: Mix.env()

config :sanbase, Sanbase.Prices.Store,
host: {:system, "INFLUXDB_HOST", "localhost"},
port: {:system, "INFLUXDB_PORT", 8086},
pool: [ max_overflow: 10, size: 20 ],
pool: [max_overflow: 10, size: 20],
database: "prices"

config :sanbase, Sanbase.Github.Store,
host: {:system, "INFLUXDB_HOST", "localhost"},
port: {:system, "INFLUXDB_PORT", 8086},
pool: [ max_overflow: 10, size: 20 ],
pool: [max_overflow: 10, size: 20],
database: "github_activity"

config :sanbase, SanbaseWorkers.ImportGithubActivity,
Expand All @@ -55,7 +53,7 @@ config :sanbase, SanbaseWorkers.ImportGithubActivity,
config :sanbase, Sanbase.ExternalServices.TwitterData.Store,
host: {:system, "INFLUXDB_HOST", "localhost"},
port: {:system, "INFLUXDB_PORT", 8086},
pool: [ max_overflow: 10, size: 20 ],
pool: [max_overflow: 10, size: 20],
database: "twitter_followers_data"

config :sanbase, Sanbase.Etherbi.Transactions.Store,
Expand All @@ -77,12 +75,12 @@ config :sanbase, Sanbase.Etherbi.TransactionVolume.Store,
database: "transaction_volume"

config :hammer,
backend: {Hammer.Backend.ETS, [expiry_ms: 60_000 * 60 * 4,
cleanup_interval_ms: 60_000 * 10]}
backend: {Hammer.Backend.ETS, [expiry_ms: 60_000 * 60 * 4, cleanup_interval_ms: 60_000 * 10]}

config :ex_admin,
repo: Sanbase.Repo,
module: SanbaseWeb, # MyProject.Web for phoenix >= 1.3.0-rc
# MyProject.Web for phoenix >= 1.3.0-rc
module: SanbaseWeb,
modules: [
Sanbase.ExAdmin.Dashboard,
Sanbase.ExAdmin.Model.Project,
Expand All @@ -105,27 +103,30 @@ config :ex_admin,
basic_auth: [
username: {:system, "ADMIN_BASIC_AUTH_USERNAME"},
password: {:system, "ADMIN_BASIC_AUTH_PASSWORD"},
realm: {:system, "ADMIN_BASIC_AUTH_REALM"}
realm: {:system, "ADMIN_BASIC_AUTH_REALM"}
]

config :xain, :after_callback, {Phoenix.HTML, :raw}

config :tesla, adapter: :hackney

config :sanbase, Sanbase.ExternalServices.Coinmarketcap,
update_interval: 5 * 1000 * 60, # 5 minutes
# 5 minutes
update_interval: 5 * 1000 * 60,
sync_enabled: {:system, "COINMARKETCAP_PRICES_ENABLED", false}

config :sanbase, Sanbase.ExternalServices.Coinmarketcap.TickerFetcher,
update_interval: 5 * 1000 * 60,
sync_enabled: {:system, "COINMARKETCAP_TICKERS_ENABLED", false}

config :sanbase, Sanbase.ExternalServices.Etherscan.Worker,
update_interval: 5 * 1000 * 60, # 5 minutes
# 5 minutes
update_interval: 5 * 1000 * 60,
sync_enabled: {:system, "ETHERSCAN_CRAWLER_ENABLED", false}

config :sanbase, Sanbase.ExternalServices.Github,
update_interval: 60 * 1000 * 60, # 60 minutes
# 60 minutes
update_interval: 60 * 1000 * 60,
sync_enabled: {:system, "GITHUB_SCHEDULER_ENABLED", false}

config :sanbase, Sanbase.ExternalServices.Etherscan.Requests,
Expand All @@ -134,12 +135,14 @@ config :sanbase, Sanbase.ExternalServices.Etherscan.Requests,
config :sanbase, Sanbase.ExternalServices.TwitterData.Worker,
consumer_key: {:system, "TWITTER_CONSUMER_KEY"},
consumer_secret: {:system, "TWITTER_CONSUMER_SECRET"},
update_interval: 1000 * 60 * 60 * 6, # 6 hours
# 6 hours
update_interval: 1000 * 60 * 60 * 6,
sync_enabled: {:system, "TWITTER_SCRAPER_ENABLED", false}

config :sanbase, Sanbase.ExternalServices.TwitterData.HistoricalData,
apikey: {:system, "TWITTERCOUNTER_API_KEY"},
update_interval: 1000 * 60 * 60 * 24, # 1 day
# 1 day
update_interval: 1000 * 60 * 60 * 24,
sync_enabled: {:system, "TWITTERCOUNTER_SCRAPER_ENABLED", false}

config :sanbase, Sanbase.Etherbi.Transactions,
Expand Down Expand Up @@ -177,11 +180,11 @@ config :faktory_worker_ex,
host: {:system, "FAKTORY_HOST", "localhost"},
port: {:system, "FAKTORY_PORT", 7419},
client: [
pool: 1,
pool: 1
],
worker: [
concurrency: 1,
queues: ["default", "data_migrations"],
queues: ["default", "data_migrations"]
],
start_workers: {:system, "FAKTORY_WORKERS_ENABLED", false}

Expand All @@ -194,9 +197,8 @@ config :ex_aws,
secret_access_key: [{:system, "AWS_SECRET_ACCESS_KEY"}, :instance_role],
region: "eu-central-1"

config :sanbase, Sanbase.Etherbi,
url: {:system, "ETHERBI_URL"}
config :sanbase, Sanbase.Etherbi, url: {:system, "ETHERBI_URL"}

# Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above.
import_config "#{Mix.env}.exs"
import_config "#{Mix.env()}.exs"
7 changes: 4 additions & 3 deletions config/dev.exs
Expand Up @@ -17,7 +17,9 @@ config :sanbase, SanbaseWeb.Endpoint,
cd: Path.expand("../app", __DIR__)
],
node: [
"node_modules/brunch/bin/brunch", "watch", "--stdin",
"node_modules/brunch/bin/brunch",
"watch",
"--stdin",
cd: Path.expand("../assets", __DIR__)
]
]
Expand All @@ -39,8 +41,7 @@ config :sanbase, SanbaseWeb.Endpoint,
# different ports.

# Do not include metadata nor timestamps in development logs
config :logger, :console,
format: "[$level] $message\n"
config :logger, :console, format: "[$level] $message\n"

# Set a higher stacktrace during development. Avoid configuring such
# in production as building large stacktraces may be expensive.
Expand Down
29 changes: 10 additions & 19 deletions config/test.exs
Expand Up @@ -17,54 +17,45 @@ config :sanbase, Sanbase.Repo,
pool: Ecto.Adapters.SQL.Sandbox,
database: "sanbase_test"

config :sanbase, Sanbase.ExternalServices.Coinmarketcap,
sync_enabled: false
config :sanbase, Sanbase.ExternalServices.Coinmarketcap, sync_enabled: false

config :sanbase, Sanbase.ExternalServices.Etherscan.RateLimiter,
scale: 1000,
limit: 5,
time_between_requests: 1000

config :sanbase, Sanbase.ExternalServices.Etherscan.Requests,
apikey: "myapikey"
config :sanbase, Sanbase.ExternalServices.Etherscan.Requests, apikey: "myapikey"

config :sanbase, Sanbase.ExternalServices.Coinmarketcap.TickerFetcher,
sync_enabled: false
config :sanbase, Sanbase.ExternalServices.Coinmarketcap.TickerFetcher, sync_enabled: false

config :sanbase, Sanbase.ExternalServices.Etherscan.Worker,
sync_enabled: false
config :sanbase, Sanbase.ExternalServices.Etherscan.Worker, sync_enabled: false

config :faktory_worker_ex,
client: [
pool: 0,
pool: 0
],
start_workers: false

config :sanbase, Sanbase.Notifications.CheckPrices,
webhook_url: "http://example.com/webhook_url",
slack_notifications_enabled: true

config :sanbase, Sanbase.Github.Store,
database: "github_activity_test"
config :sanbase, Sanbase.Github.Store, database: "github_activity_test"

config :sanbase, Sanbase.ExternalServices.TwitterData.Store,
database: "twitter_followers_data_test"

config :sanbase, Sanbase.Etherbi.Transactions.Store,
database: "transactions_test"
config :sanbase, Sanbase.Etherbi.Transactions.Store, database: "transactions_test"

config :sanbase, Sanbase.Etherbi.BurnRate.Store,
database: "burn_rate_test"
config :sanbase, Sanbase.Etherbi.BurnRate.Store, database: "burn_rate_test"

config :sanbase, Sanbase.Etherbi.TransactionVolume.Store,
database: "transaction_volume_test"
config :sanbase, Sanbase.Etherbi.TransactionVolume.Store, database: "transaction_volume_test"

config :sanbase, SanbaseWeb.Graphql.ContextPlug,
basic_auth_username: "user",
basic_auth_password: "pass"

config :sanbase, Sanbase.Prices.Store,
database: "prices_test"
config :sanbase, Sanbase.Prices.Store, database: "prices_test"

if File.exists?("config/test.secret.exs") do
import_config "test.secret.exs"
Expand Down
17 changes: 12 additions & 5 deletions lib/mix/tasks/import_ico_spreadsheet.ex
Expand Up @@ -24,9 +24,12 @@ defmodule Mix.Tasks.ImportIcoSpreadsheet do
alias Sanbase.ExternalServices.IcoSpreadsheet

def run(args) do
parsed_args = OptionParser.parse(args,
strict: [document_id: :string, api_key: :string, dry_run: :boolean],
aliases: [d: :document_id, a: :api_key])
parsed_args =
OptionParser.parse(
args,
strict: [document_id: :string, api_key: :string, dry_run: :boolean],
aliases: [d: :document_id, a: :api_key]
)

{switches, project_names, errors} = parsed_args

Expand All @@ -35,11 +38,15 @@ defmodule Mix.Tasks.ImportIcoSpreadsheet do
|> case do
[document_id: document_id, api_key: api_key, dry_run: dry_run] ->
cond do
Enum.empty?(errors) -> import(document_id, api_key, dry_run, project_names)
Enum.empty?(errors) ->
import(document_id, api_key, dry_run, project_names)

true ->
IO.puts("Missing or invalid arguments")
end
_ -> IO.puts("Missing or invalid arguments")

_ ->
IO.puts("Missing or invalid arguments")
end
end

Expand Down

0 comments on commit 6874206

Please sign in to comment.